<!DOCTYPE html>
<html lang="en-US" dir="ltr">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>设置 | 阿泽的笔记</title>
    <meta name="description" content="做一个努力的码农">
    <link rel="preload stylesheet" href="/assets/style.47519a3e.css" as="style">
    
    <script type="module" src="/assets/app.130cc073.js"></script>
    <link rel="preload" href="/assets/inter-roman-latin.2ed14f66.woff2" as="font" type="font/woff2" crossorigin="">
    <link rel="modulepreload" href="/assets/chunks/framework.cc795e4d.js">
    <link rel="modulepreload" href="/assets/chunks/theme.3ebce9b1.js">
    <link rel="modulepreload" href="/assets/tools_php基础及常用函数.md.b2afeccf.lean.js">
    <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
    <script id="check-mac-os">document.documentElement.classList.toggle("mac",/Mac|iPhone|iPod|iPad/i.test(navigator.platform));</script>
  </head>
  <body>
    <div id="app"><div class="Layout" data-v-5a346dfe><!--[--><!--]--><!--[--><span tabindex="-1" data-v-0f60ec36></span><a href="#VPContent" class="VPSkipLink visually-hidden" data-v-0f60ec36> Skip to content </a><!--]--><!----><header class="VPNav" data-v-5a346dfe data-v-ae24b3ad><div class="VPNavBar has-sidebar" data-v-ae24b3ad data-v-a0fd61f4><div class="container" data-v-a0fd61f4><div class="title" data-v-a0fd61f4><div class="VPNavBarTitle has-sidebar" data-v-a0fd61f4 data-v-86d1bed8><a class="title" href="/" data-v-86d1bed8><!--[--><!--]--><!----><!--[-->阿泽的笔记<!--]--><!--[--><!--]--></a></div></div><div class="content" data-v-a0fd61f4><div class="curtain" data-v-a0fd61f4></div><div class="content-body" data-v-a0fd61f4><!--[--><!--]--><div class="VPNavBarSearch search" data-v-a0fd61f4><!----></div><nav aria-labelledby="main-nav-aria-label" class="VPNavBarMenu menu" data-v-a0fd61f4 data-v-7f418b0f><span id="main-nav-aria-label" class="visually-hidden" data-v-7f418b0f>Main Navigation</span><!--[--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/" tabindex="0" data-v-7f418b0f data-v-42ef59de><!--[--><span data-v-42ef59de>首页</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/case/" tabindex="0" data-v-7f418b0f data-v-42ef59de><!--[--><span data-v-42ef59de>案例</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/tools/" tabindex="0" data-v-7f418b0f data-v-42ef59de><!--[--><span data-v-42ef59de>工具</span><!--]--></a><!--]--><!--]--></nav><!----><div class="VPNavBarAppearance appearance" data-v-a0fd61f4 data-v-e6aabb21><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title="toggle dark mode" aria-checked="false" data-v-e6aabb21 data-v-ce54a7d1 data-v-b1685198><span class="check" data-v-b1685198><span class="icon" data-v-b1685198><!--[--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="sun" data-v-ce54a7d1><path d="M12,18c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S15.3,18,12,18zM12,8c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4c2.2,0,4-1.8,4-4C16,9.8,14.2,8,12,8z"></path><path d="M12,4c-0.6,0-1-0.4-1-1V1c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,3.6,12.6,4,12,4z"></path><path d="M12,24c-0.6,0-1-0.4-1-1v-2c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,23.6,12.6,24,12,24z"></path><path d="M5.6,6.6c-0.3,0-0.5-0.1-0.7-0.3L3.5,4.9c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C6.2,6.5,5.9,6.6,5.6,6.6z"></path><path d="M19.8,20.8c-0.3,0-0.5-0.1-0.7-0.3l-1.4-1.4c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C20.3,20.7,20,20.8,19.8,20.8z"></path><path d="M3,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S3.6,13,3,13z"></path><path d="M23,13h-2c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S23.6,13,23,13z"></path><path d="M4.2,20.8c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C4.7,20.7,4.5,20.8,4.2,20.8z"></path><path d="M18.4,6.6c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C18.9,6.5,18.6,6.6,18.4,6.6z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="moon" data-v-ce54a7d1><path d="M12.1,22c-0.3,0-0.6,0-0.9,0c-5.5-0.5-9.5-5.4-9-10.9c0.4-4.8,4.2-8.6,9-9c0.4,0,0.8,0.2,1,0.5c0.2,0.3,0.2,0.8-0.1,1.1c-2,2.7-1.4,6.4,1.3,8.4c2.1,1.6,5,1.6,7.1,0c0.3-0.2,0.7-0.3,1.1-0.1c0.3,0.2,0.5,0.6,0.5,1c-0.2,2.7-1.5,5.1-3.6,6.8C16.6,21.2,14.4,22,12.1,22zM9.3,4.4c-2.9,1-5,3.6-5.2,6.8c-0.4,4.4,2.8,8.3,7.2,8.7c2.1,0.2,4.2-0.4,5.8-1.8c1.1-0.9,1.9-2.1,2.4-3.4c-2.5,0.9-5.3,0.5-7.5-1.1C9.2,11.4,8.1,7.7,9.3,4.4z"></path></svg><!--]--></span></span></button></div><!----><div class="VPFlyout VPNavBarExtra extra" data-v-a0fd61f4 data-v-40855f84 data-v-9c007e85><button type="button" class="button" aria-haspopup="true" aria-expanded="false" aria-label="extra navigation" data-v-9c007e85><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="icon" data-v-9c007e85><circle cx="12" cy="12" r="2"></circle><circle cx="19" cy="12" r="2"></circle><circle cx="5" cy="12" r="2"></circle></svg></button><div class="menu" data-v-9c007e85><div class="VPMenu" data-v-9c007e85 data-v-e7ea1737><!----><!--[--><!--[--><!----><div class="group" data-v-40855f84><div class="item appearance" data-v-40855f84><p class="label" data-v-40855f84>Appearance</p><div class="appearance-action" data-v-40855f84><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title="toggle dark mode" aria-checked="false" data-v-40855f84 data-v-ce54a7d1 data-v-b1685198><span class="check" data-v-b1685198><span class="icon" data-v-b1685198><!--[--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="sun" data-v-ce54a7d1><path d="M12,18c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S15.3,18,12,18zM12,8c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4c2.2,0,4-1.8,4-4C16,9.8,14.2,8,12,8z"></path><path d="M12,4c-0.6,0-1-0.4-1-1V1c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,3.6,12.6,4,12,4z"></path><path d="M12,24c-0.6,0-1-0.4-1-1v-2c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,23.6,12.6,24,12,24z"></path><path d="M5.6,6.6c-0.3,0-0.5-0.1-0.7-0.3L3.5,4.9c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C6.2,6.5,5.9,6.6,5.6,6.6z"></path><path d="M19.8,20.8c-0.3,0-0.5-0.1-0.7-0.3l-1.4-1.4c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C20.3,20.7,20,20.8,19.8,20.8z"></path><path d="M3,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S3.6,13,3,13z"></path><path d="M23,13h-2c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S23.6,13,23,13z"></path><path d="M4.2,20.8c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C4.7,20.7,4.5,20.8,4.2,20.8z"></path><path d="M18.4,6.6c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C18.9,6.5,18.6,6.6,18.4,6.6z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="moon" data-v-ce54a7d1><path d="M12.1,22c-0.3,0-0.6,0-0.9,0c-5.5-0.5-9.5-5.4-9-10.9c0.4-4.8,4.2-8.6,9-9c0.4,0,0.8,0.2,1,0.5c0.2,0.3,0.2,0.8-0.1,1.1c-2,2.7-1.4,6.4,1.3,8.4c2.1,1.6,5,1.6,7.1,0c0.3-0.2,0.7-0.3,1.1-0.1c0.3,0.2,0.5,0.6,0.5,1c-0.2,2.7-1.5,5.1-3.6,6.8C16.6,21.2,14.4,22,12.1,22zM9.3,4.4c-2.9,1-5,3.6-5.2,6.8c-0.4,4.4,2.8,8.3,7.2,8.7c2.1,0.2,4.2-0.4,5.8-1.8c1.1-0.9,1.9-2.1,2.4-3.4c-2.5,0.9-5.3,0.5-7.5-1.1C9.2,11.4,8.1,7.7,9.3,4.4z"></path></svg><!--]--></span></span></button></div></div></div><!----><!--]--><!--]--></div></div></div><!--[--><!--]--><button type="button" class="VPNavBarHamburger hamburger" aria-label="mobile navigation" aria-expanded="false" aria-controls="VPNavScreen" data-v-a0fd61f4 data-v-e5dd9c1c><span class="container" data-v-e5dd9c1c><span class="top" data-v-e5dd9c1c></span><span class="middle" data-v-e5dd9c1c></span><span class="bottom" data-v-e5dd9c1c></span></span></button></div></div></div></div><!----></header><div class="VPLocalNav reached-top" data-v-5a346dfe data-v-79c8c1df><button class="menu" aria-expanded="false" aria-controls="VPSidebarNav" data-v-79c8c1df><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="menu-icon" data-v-79c8c1df><path d="M17,11H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h14c0.6,0,1,0.4,1,1S17.6,11,17,11z"></path><path d="M21,7H3C2.4,7,2,6.6,2,6s0.4-1,1-1h18c0.6,0,1,0.4,1,1S21.6,7,21,7z"></path><path d="M21,15H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h18c0.6,0,1,0.4,1,1S21.6,15,21,15z"></path><path d="M17,19H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h14c0.6,0,1,0.4,1,1S17.6,19,17,19z"></path></svg><span class="menu-text" data-v-79c8c1df>Menu</span></button><div class="VPLocalNavOutlineDropdown" style="--vp-vh:0px;" data-v-79c8c1df data-v-1c15a60a><button data-v-1c15a60a>Return to top</button><!----></div></div><aside class="VPSidebar" data-v-5a346dfe data-v-b00e2fdd><div class="curtain" data-v-b00e2fdd></div><nav class="nav" id="VPSidebarNav" aria-labelledby="sidebar-aria-label" tabindex="-1" data-v-b00e2fdd><span class="visually-hidden" id="sidebar-aria-label" data-v-b00e2fdd> Sidebar Navigation </span><!--[--><!--]--><!--[--><div class="group" data-v-b00e2fdd><section class="VPSidebarItem level-0 collapsible has-active" data-v-b00e2fdd data-v-e31bd47b><div class="item" role="button" tabindex="0" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><h2 class="text" data-v-e31bd47b>工具</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-e31bd47b><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-e31bd47b><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-e31bd47b><!--[--><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/adb%E5%91%BD%E4%BB%A4.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>adb命令</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/arduino%E5%9F%BA%E7%A1%80%E6%93%8D%E4%BD%9C.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>arduino基础操作</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/cmd%20npm%20yarn%20pnpm%E5%91%BD%E4%BB%A4.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>cmd npm yarn pnpm命令</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/elementUi%E7%AC%94%E8%AE%B0.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>elementUi笔记</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/Emmet%20Web%E5%BF%AB%E9%80%9F%E6%9E%84%E5%BB%BA%E5%91%BD%E4%BB%A4.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>Emmet Web快速构建命令</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/git%E7%AC%94%E8%AE%B0.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>git笔记</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/js%E7%9F%A5%E8%AF%86%E7%82%B9.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>js知识点</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/linux%E5%91%BD%E4%BB%A4.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>linux命令</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/linux%E5%9F%9F%E5%90%8D%E9%85%8D%E7%BD%AE%E5%8F%8A%E5%8F%8D%E5%90%91%E4%BB%A3%E7%90%86.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>linux域名配置及反向代理</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/mac%E4%BD%BF%E7%94%A8%E7%AC%94%E8%AE%B0.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>mac使用笔记</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/mysql%E5%91%BD%E4%BB%A4.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>mysql命令</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/php%E5%9F%BA%E7%A1%80%E5%8F%8A%E5%B8%B8%E7%94%A8%E5%87%BD%E6%95%B0.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>php基础及常用函数</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/react.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>react</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/uniapp%E7%AC%94%E8%AE%B0.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>uniapp笔记</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/vue%E7%AC%94%E8%AE%B0.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>vue笔记</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/tools/%E5%89%8D%E7%AB%AF%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>前端基础知识</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-b00e2fdd><section class="VPSidebarItem level-0 collapsible collapsed" data-v-b00e2fdd data-v-e31bd47b><div class="item" role="button" tabindex="0" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><h2 class="text" data-v-e31bd47b>案例</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-e31bd47b><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-e31bd47b><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-e31bd47b><!--[--><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/case/css%E6%8A%80%E5%B7%A7.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>css技巧</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/case/python%E8%87%AA%E5%8A%A8%E6%B5%8B%E8%AF%95%E8%84%9A%E6%9C%AC.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>python自动测试脚本</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/case/uniapp%E8%B8%A9%E5%9D%91%E8%AE%B0%E5%BD%95.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>uniapp踩坑记录</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/case/vuex%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>vuex使用示例</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/case/vue%E5%85%AD%E7%A7%8Dl%E4%BC%A0%E8%BE%93%E6%96%B9%E5%BC%8F.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>vue六种l传输方式</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/case/vue%E5%AE%9E%E4%BE%8B%E6%8A%80%E5%B7%A7.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>vue实例技巧</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/case/%E4%BC%98%E7%A7%80%E7%9A%84%E5%BC%80%E6%BA%90vue%E7%BB%84%E4%BB%B6.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>优秀的开源vue组件</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/case/%E5%89%8D%E7%AB%AF%E6%97%A5%E5%BF%97.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>前端日志</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/case/%E5%BC%80%E5%8F%91%E5%AF%8C%E6%96%87%E6%9C%AC%E6%9C%AC%E7%BC%96%E8%BE%91%E5%99%A8.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>开发富文本本编辑器</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/case/%E6%8F%92%E4%BB%B6%E4%BD%BF%E7%94%A8%E9%85%8D%E7%BD%AE.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>插件使用配置</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/case/%E6%A0%B7%E5%BC%8F%E5%B8%83%E5%B1%80.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>样式布局</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-e31bd47b data-v-e31bd47b><div class="item" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><a class="VPLink link link" href="/case/%E8%BD%ACpdf%E7%9B%B8%E5%85%B3.html" data-v-e31bd47b><!--[--><p class="text" data-v-e31bd47b>转pdf相关</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><!--]--><!--[--><!--]--></nav></aside><div class="VPContent has-sidebar" id="VPContent" data-v-5a346dfe data-v-669faec9><div class="VPDoc has-sidebar has-aside" data-v-669faec9 data-v-6b87e69f><!--[--><!--]--><div class="container" data-v-6b87e69f><div class="aside" data-v-6b87e69f><div class="aside-curtain" data-v-6b87e69f></div><div class="aside-container" data-v-6b87e69f><div class="aside-content" data-v-6b87e69f><div class="VPDocAside" data-v-6b87e69f data-v-3f215769><!--[--><!--]--><!--[--><!--]--><div class="VPDocAsideOutline" role="navigation" data-v-3f215769 data-v-d330b1bb><div class="content" data-v-d330b1bb><div class="outline-marker" data-v-d330b1bb></div><div class="outline-title" role="heading" aria-level="2" data-v-d330b1bb>On this page</div><nav aria-labelledby="doc-outline-aria-label" data-v-d330b1bb><span class="visually-hidden" id="doc-outline-aria-label" data-v-d330b1bb> Table of Contents for current page </span><ul class="root" data-v-d330b1bb data-v-d0ee3533><!--[--><!--]--></ul></nav></div></div><!--[--><!--]--><div class="spacer" data-v-3f215769></div><!--[--><!--]--><!----><!--[--><!--]--><!--[--><!--]--></div></div></div></div><div class="content" data-v-6b87e69f><div class="content-container" data-v-6b87e69f><!--[--><!--]--><!----><main class="main" data-v-6b87e69f><div style="position:relative;" class="vp-doc _tools_php%E5%9F%BA%E7%A1%80%E5%8F%8A%E5%B8%B8%E7%94%A8%E5%87%BD%E6%95%B0" data-v-6b87e69f><div><h1 id="设置" tabindex="-1">设置 <a class="header-anchor" href="#设置" aria-label="Permalink to &quot;设置&quot;">​</a></h1><h2 id="系统设置" tabindex="-1">系统设置 <a class="header-anchor" href="#系统设置" aria-label="Permalink to &quot;系统设置&quot;">​</a></h2><div class="language-php vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">php</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#79B8FF;">ini_set</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot;display_errors&quot;</span><span style="color:#E1E4E8;">, </span><span style="color:#79B8FF;">1</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;"> 	</span><span style="color:#79B8FF;">error_reporting</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">E_ALL</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">|</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">E_STRICT</span><span style="color:#E1E4E8;">); </span><span style="color:#6A737D;">//打开报错</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292E;">	</span><span style="color:#005CC5;">ini_set</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot;display_errors&quot;</span><span style="color:#24292E;">, </span><span style="color:#005CC5;">1</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;"> 	</span><span style="color:#005CC5;">error_reporting</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">E_ALL</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">|</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">E_STRICT</span><span style="color:#24292E;">); </span><span style="color:#6A737D;">//打开报错</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><h1 id="特殊用法" tabindex="-1">特殊用法 <a class="header-anchor" href="#特殊用法" aria-label="Permalink to &quot;特殊用法&quot;">​</a></h1><h2 id="herodoc写法" tabindex="-1">herodoc写法 <a class="header-anchor" href="#herodoc写法" aria-label="Permalink to &quot;herodoc写法&quot;">​</a></h2><div class="language- vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">&lt;?php  </span></span>
<span class="line"><span style="color:#e1e4e8;">$name = &#39;浅水游&#39;;  </span></span>
<span class="line"><span style="color:#e1e4e8;">print &lt;&lt;&lt;EOT  </span></span>
<span class="line"><span style="color:#e1e4e8;">&lt;html&gt;</span></span>
<span class="line"><span style="color:#e1e4e8;">...</span></span>
<span class="line"><span style="color:#e1e4e8;">&lt;/html&gt;</span></span>
<span class="line"><span style="color:#e1e4e8;">EOT;  </span></span>
<span class="line"><span style="color:#e1e4e8;">?&gt;</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">&lt;?php  </span></span>
<span class="line"><span style="color:#24292e;">$name = &#39;浅水游&#39;;  </span></span>
<span class="line"><span style="color:#24292e;">print &lt;&lt;&lt;EOT  </span></span>
<span class="line"><span style="color:#24292e;">&lt;html&gt;</span></span>
<span class="line"><span style="color:#24292e;">...</span></span>
<span class="line"><span style="color:#24292e;">&lt;/html&gt;</span></span>
<span class="line"><span style="color:#24292e;">EOT;  </span></span>
<span class="line"><span style="color:#24292e;">?&gt;</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br></div></div><h2 id="函数中使用use" tabindex="-1">函数中使用use <a class="header-anchor" href="#函数中使用use" aria-label="Permalink to &quot;函数中使用use&quot;">​</a></h2><div class="language-php vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">php</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#F97583;">function</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">test</span><span style="color:#E1E4E8;">(){</span></span>
<span class="line"><span style="color:#E1E4E8;">    $word </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&#39;world&#39;</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">    $func </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">function</span><span style="color:#E1E4E8;">($para)</span><span style="color:#F97583;">use</span><span style="color:#E1E4E8;">($word){</span></span>
<span class="line"><span style="color:#E1E4E8;">        </span><span style="color:#79B8FF;">echo</span><span style="color:#E1E4E8;"> $para </span><span style="color:#F97583;">.</span><span style="color:#9ECBFF;">&quot; &quot;</span><span style="color:#F97583;">.</span><span style="color:#E1E4E8;">$word;</span></span>
<span class="line"><span style="color:#E1E4E8;">    };</span></span>
<span class="line"><span style="color:#E1E4E8;">    $word </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&#39;php&#39;</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> $func;</span></span>
<span class="line"><span style="color:#E1E4E8;">}</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#D73A49;">function</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">test</span><span style="color:#24292E;">(){</span></span>
<span class="line"><span style="color:#24292E;">    $word </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&#39;world&#39;</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">    $func </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">function</span><span style="color:#24292E;">($para)</span><span style="color:#D73A49;">use</span><span style="color:#24292E;">($word){</span></span>
<span class="line"><span style="color:#24292E;">        </span><span style="color:#005CC5;">echo</span><span style="color:#24292E;"> $para </span><span style="color:#D73A49;">.</span><span style="color:#032F62;">&quot; &quot;</span><span style="color:#D73A49;">.</span><span style="color:#24292E;">$word;</span></span>
<span class="line"><span style="color:#24292E;">    };</span></span>
<span class="line"><span style="color:#24292E;">    $word </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&#39;php&#39;</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> $func;</span></span>
<span class="line"><span style="color:#24292E;">}</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br></div></div><h1 id="常用函数" tabindex="-1">常用函数 <a class="header-anchor" href="#常用函数" aria-label="Permalink to &quot;常用函数&quot;">​</a></h1><h2 id="字符串类" tabindex="-1">字符串类 <a class="header-anchor" href="#字符串类" aria-label="Permalink to &quot;字符串类&quot;">​</a></h2><div class="language-php vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">php</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#79B8FF;">1.</span><span style="color:#E1E4E8;">    </span><span style="color:#79B8FF;">header</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot;Content-type: text/html; charset=utf-8&quot;</span><span style="color:#E1E4E8;">);  </span><span style="color:#6A737D;">//输入utf8</span></span>
<span class="line"><span style="color:#79B8FF;">2.</span><span style="color:#E1E4E8;">    $string </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">file_get_contents</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;php://input&#39;</span><span style="color:#E1E4E8;">, </span><span style="color:#9ECBFF;">&#39;r&#39;</span><span style="color:#E1E4E8;">);  </span><span style="color:#6A737D;">//接收以json格式post传值（ajax)</span></span>
<span class="line"><span style="color:#79B8FF;">3.</span><span style="color:#E1E4E8;">    </span><span style="color:#79B8FF;">header</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;Content-type: application/json&#39;</span><span style="color:#E1E4E8;">);  </span><span style="color:#6A737D;">//输入json格式效果 用于接口规范  </span></span>
<span class="line"><span style="color:#79B8FF;">4.</span><span style="color:#E1E4E8;">    </span><span style="color:#79B8FF;">header</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;Access-Control-Allow-Origin:*&#39;</span><span style="color:#E1E4E8;">);</span><span style="color:#6A737D;">//跨域需要加上</span></span>
<span class="line"><span style="color:#79B8FF;">5.</span><span style="color:#E1E4E8;">    </span><span style="color:#79B8FF;">str_replace</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;null&#39;</span><span style="color:#E1E4E8;">,</span><span style="color:#9ECBFF;">&#39;&quot;&quot;&#39;</span><span style="color:#E1E4E8;">,$comments); </span><span style="color:#6A737D;">//替换字符</span></span>
<span class="line"><span style="color:#79B8FF;">6.</span><span style="color:#E1E4E8;">    $works</span><span style="color:#F97583;">-&gt;</span><span style="color:#E1E4E8;">des </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">strip_tags</span><span style="color:#E1E4E8;">($works</span><span style="color:#F97583;">-&gt;</span><span style="color:#E1E4E8;">des);</span><span style="color:#6A737D;">//去除Html标签</span></span>
<span class="line"><span style="color:#79B8FF;">7.</span><span style="color:#E1E4E8;">    $v</span><span style="color:#F97583;">-&gt;</span><span style="color:#E1E4E8;">title </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">mb_substr</span><span style="color:#E1E4E8;">($v</span><span style="color:#F97583;">-&gt;</span><span style="color:#E1E4E8;">title,</span><span style="color:#79B8FF;">0</span><span style="color:#E1E4E8;">,</span><span style="color:#79B8FF;">30</span><span style="color:#E1E4E8;">,</span><span style="color:#9ECBFF;">&#39;utf-8&#39;</span><span style="color:#E1E4E8;">)</span><span style="color:#F97583;">.</span><span style="color:#9ECBFF;">&#39;...&#39;</span><span style="color:#E1E4E8;">;</span><span style="color:#6A737D;">//截取中文字符</span></span>
<span class="line"><span style="color:#79B8FF;">8.</span><span style="color:#E1E4E8;">    </span><span style="color:#79B8FF;">trim</span><span style="color:#E1E4E8;">($str,</span><span style="color:#9ECBFF;">&#39;、&#39;</span><span style="color:#E1E4E8;">);</span><span style="color:#6A737D;">//去除两端某字符</span></span>
<span class="line"><span style="color:#79B8FF;">9.</span><span style="color:#E1E4E8;">    </span><span style="color:#79B8FF;">substr</span><span style="color:#E1E4E8;">($str,</span><span style="color:#79B8FF;">0</span><span style="color:#E1E4E8;">,</span><span style="color:#F97583;">-</span><span style="color:#79B8FF;">1</span><span style="color:#E1E4E8;">); </span><span style="color:#6A737D;">//去除右侧一个字符（中文标点及文字utf8为3个字符）</span></span>
<span class="line"><span style="color:#79B8FF;">10.</span><span style="color:#E1E4E8;">    </span><span style="color:#79B8FF;">substr</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">strrchr</span><span style="color:#E1E4E8;">($file, </span><span style="color:#9ECBFF;">&#39;.&#39;</span><span style="color:#E1E4E8;">), </span><span style="color:#79B8FF;">1</span><span style="color:#E1E4E8;">);  </span><span style="color:#6A737D;">//取拓展名</span></span>
<span class="line"><span style="color:#79B8FF;">11.</span><span style="color:#E1E4E8;">    </span><span style="color:#79B8FF;">strpos</span><span style="color:#E1E4E8;">($content, $tr) </span><span style="color:#F97583;">!==</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">false</span><span style="color:#E1E4E8;"> </span><span style="color:#6A737D;">//检查是否包含某字符</span></span>
<span class="line"><span style="color:#79B8FF;">12.</span><span style="color:#E1E4E8;">    </span><span style="color:#79B8FF;">str_replace</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot;world&quot;</span><span style="color:#E1E4E8;">,</span><span style="color:#9ECBFF;">&quot;Shanghai&quot;</span><span style="color:#E1E4E8;">,</span><span style="color:#9ECBFF;">&quot;Hello world!&quot;</span><span style="color:#E1E4E8;">);  </span><span style="color:#6A737D;">//替换字符串</span></span>
<span class="line"><span style="color:#79B8FF;">13.</span><span style="color:#E1E4E8;">    $con_str </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">preg_replace</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot;/</span><span style="color:#DBEDFF;">&lt;a[^&gt;]</span><span style="color:#F97583;">*</span><span style="color:#DBEDFF;">href=[^&gt;]</span><span style="color:#F97583;">*</span><span style="color:#DBEDFF;">&gt;|&lt;\/[^a]</span><span style="color:#F97583;">*</span><span style="color:#DBEDFF;">a[^&gt;]</span><span style="color:#F97583;">*</span><span style="color:#DBEDFF;">&gt;</span><span style="color:#9ECBFF;">/i&quot;</span><span style="color:#E1E4E8;">,</span><span style="color:#9ECBFF;">&quot;&quot;</span><span style="color:#E1E4E8;">,$con); </span><span style="color:#6A737D;">//正则去除超链接</span></span>
<span class="line"><span style="color:#79B8FF;">14.</span><span style="color:#E1E4E8;">   $rescult </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">http\_build\</span><span style="color:#B392F0;">_query</span><span style="color:#E1E4E8;">($data);  </span><span style="color:#6A737D;">//转换为请求格式name=callback&amp;value=test</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#005CC5;">1.</span><span style="color:#24292E;">    </span><span style="color:#005CC5;">header</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot;Content-type: text/html; charset=utf-8&quot;</span><span style="color:#24292E;">);  </span><span style="color:#6A737D;">//输入utf8</span></span>
<span class="line"><span style="color:#005CC5;">2.</span><span style="color:#24292E;">    $string </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">file_get_contents</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;php://input&#39;</span><span style="color:#24292E;">, </span><span style="color:#032F62;">&#39;r&#39;</span><span style="color:#24292E;">);  </span><span style="color:#6A737D;">//接收以json格式post传值（ajax)</span></span>
<span class="line"><span style="color:#005CC5;">3.</span><span style="color:#24292E;">    </span><span style="color:#005CC5;">header</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;Content-type: application/json&#39;</span><span style="color:#24292E;">);  </span><span style="color:#6A737D;">//输入json格式效果 用于接口规范  </span></span>
<span class="line"><span style="color:#005CC5;">4.</span><span style="color:#24292E;">    </span><span style="color:#005CC5;">header</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;Access-Control-Allow-Origin:*&#39;</span><span style="color:#24292E;">);</span><span style="color:#6A737D;">//跨域需要加上</span></span>
<span class="line"><span style="color:#005CC5;">5.</span><span style="color:#24292E;">    </span><span style="color:#005CC5;">str_replace</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;null&#39;</span><span style="color:#24292E;">,</span><span style="color:#032F62;">&#39;&quot;&quot;&#39;</span><span style="color:#24292E;">,$comments); </span><span style="color:#6A737D;">//替换字符</span></span>
<span class="line"><span style="color:#005CC5;">6.</span><span style="color:#24292E;">    $works</span><span style="color:#D73A49;">-&gt;</span><span style="color:#24292E;">des </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">strip_tags</span><span style="color:#24292E;">($works</span><span style="color:#D73A49;">-&gt;</span><span style="color:#24292E;">des);</span><span style="color:#6A737D;">//去除Html标签</span></span>
<span class="line"><span style="color:#005CC5;">7.</span><span style="color:#24292E;">    $v</span><span style="color:#D73A49;">-&gt;</span><span style="color:#24292E;">title </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">mb_substr</span><span style="color:#24292E;">($v</span><span style="color:#D73A49;">-&gt;</span><span style="color:#24292E;">title,</span><span style="color:#005CC5;">0</span><span style="color:#24292E;">,</span><span style="color:#005CC5;">30</span><span style="color:#24292E;">,</span><span style="color:#032F62;">&#39;utf-8&#39;</span><span style="color:#24292E;">)</span><span style="color:#D73A49;">.</span><span style="color:#032F62;">&#39;...&#39;</span><span style="color:#24292E;">;</span><span style="color:#6A737D;">//截取中文字符</span></span>
<span class="line"><span style="color:#005CC5;">8.</span><span style="color:#24292E;">    </span><span style="color:#005CC5;">trim</span><span style="color:#24292E;">($str,</span><span style="color:#032F62;">&#39;、&#39;</span><span style="color:#24292E;">);</span><span style="color:#6A737D;">//去除两端某字符</span></span>
<span class="line"><span style="color:#005CC5;">9.</span><span style="color:#24292E;">    </span><span style="color:#005CC5;">substr</span><span style="color:#24292E;">($str,</span><span style="color:#005CC5;">0</span><span style="color:#24292E;">,</span><span style="color:#D73A49;">-</span><span style="color:#005CC5;">1</span><span style="color:#24292E;">); </span><span style="color:#6A737D;">//去除右侧一个字符（中文标点及文字utf8为3个字符）</span></span>
<span class="line"><span style="color:#005CC5;">10.</span><span style="color:#24292E;">    </span><span style="color:#005CC5;">substr</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">strrchr</span><span style="color:#24292E;">($file, </span><span style="color:#032F62;">&#39;.&#39;</span><span style="color:#24292E;">), </span><span style="color:#005CC5;">1</span><span style="color:#24292E;">);  </span><span style="color:#6A737D;">//取拓展名</span></span>
<span class="line"><span style="color:#005CC5;">11.</span><span style="color:#24292E;">    </span><span style="color:#005CC5;">strpos</span><span style="color:#24292E;">($content, $tr) </span><span style="color:#D73A49;">!==</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">false</span><span style="color:#24292E;"> </span><span style="color:#6A737D;">//检查是否包含某字符</span></span>
<span class="line"><span style="color:#005CC5;">12.</span><span style="color:#24292E;">    </span><span style="color:#005CC5;">str_replace</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot;world&quot;</span><span style="color:#24292E;">,</span><span style="color:#032F62;">&quot;Shanghai&quot;</span><span style="color:#24292E;">,</span><span style="color:#032F62;">&quot;Hello world!&quot;</span><span style="color:#24292E;">);  </span><span style="color:#6A737D;">//替换字符串</span></span>
<span class="line"><span style="color:#005CC5;">13.</span><span style="color:#24292E;">    $con_str </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">preg_replace</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot;/&lt;a[^&gt;]</span><span style="color:#D73A49;">*</span><span style="color:#032F62;">href=[^&gt;]</span><span style="color:#D73A49;">*</span><span style="color:#032F62;">&gt;|&lt;\/[^a]</span><span style="color:#D73A49;">*</span><span style="color:#032F62;">a[^&gt;]</span><span style="color:#D73A49;">*</span><span style="color:#032F62;">&gt;/i&quot;</span><span style="color:#24292E;">,</span><span style="color:#032F62;">&quot;&quot;</span><span style="color:#24292E;">,$con); </span><span style="color:#6A737D;">//正则去除超链接</span></span>
<span class="line"><span style="color:#005CC5;">14.</span><span style="color:#24292E;">   $rescult </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">http\_build\</span><span style="color:#6F42C1;">_query</span><span style="color:#24292E;">($data);  </span><span style="color:#6A737D;">//转换为请求格式name=callback&amp;value=test</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br></div></div><h3 id="正则处理函数" tabindex="-1">正则处理函数 <a class="header-anchor" href="#正则处理函数" aria-label="Permalink to &quot;正则处理函数&quot;">​</a></h3><p>1.空行 [\n,\s,\r]{0,4} 2.空格 \s{0,4} \3. 非贪婪匹配 (.<em>?) \4. 全部匹配 ([\s\S]</em>) 5.正则匹配获取与替换</p><div class="language-php vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">php</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#6A737D;">//判断</span></span>
<span class="line"><span style="color:#F97583;">if</span><span style="color:#E1E4E8;">(</span><span style="color:#F97583;">!</span><span style="color:#79B8FF;">preg_match</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot;/</span><span style="color:#F97583;">^</span><span style="color:#DBEDFF;">[1-9][0-9]{4,}</span><span style="color:#F97583;">$</span><span style="color:#9ECBFF;">/&quot;</span><span style="color:#E1E4E8;">,$data_info[</span><span style="color:#9ECBFF;">&#39;qq&#39;</span><span style="color:#E1E4E8;">])){</span></span>
<span class="line"><span style="color:#E1E4E8;">	$return_arr[</span><span style="color:#9ECBFF;">&#39;code&#39;</span><span style="color:#E1E4E8;">] </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">7</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">	$return_arr[</span><span style="color:#9ECBFF;">&#39;msg&#39;</span><span style="color:#E1E4E8;">] </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&#39;请填写正确qq号&#39;</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#79B8FF;">echo</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">json_encode</span><span style="color:#E1E4E8;">($return_arr);</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">die</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">} </span></span>
<span class="line"><span style="color:#6A737D;">//取内容</span></span>
<span class="line"><span style="color:#E1E4E8;">$rule_mean </span><span style="color:#F97583;">=</span><span style="color:#9ECBFF;">&quot;/</span><span style="color:#DBEDFF;">([\w]</span><span style="color:#F97583;">+</span><span style="color:#DBEDFF;">?).\s{0,4}(&lt;a\s{0,4}href=&#39;show-[\w]</span><span style="color:#F97583;">+</span><span style="color:#DBEDFF;">?\</span><span style="color:#F97583;">+</span><span style="color:#DBEDFF;">.{1,30}?-0.html&#39;&gt;&lt;font\s{0,4}color=olive&gt;&lt;u&gt;(.</span><span style="color:#F97583;">*</span><span style="color:#DBEDFF;">?)&lt;\/u&gt;&lt;\/font&gt;\s{0,4}&lt;\/a&gt;){1,}&lt;br&gt;</span><span style="color:#9ECBFF;">/&quot;</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">preg_match_all</span><span style="color:#E1E4E8;">($rule_mean,$content,$list_str)){</span></span>
<span class="line"><span style="color:#E1E4E8;">		  </span><span style="color:#79B8FF;">var_dump</span><span style="color:#E1E4E8;">($list_str);</span></span>
<span class="line"><span style="color:#E1E4E8;">    }</span><span style="color:#F97583;">else</span><span style="color:#E1E4E8;">{</span></span>
<span class="line"><span style="color:#E1E4E8;">	    </span><span style="color:#79B8FF;">echo</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&#39;mean not found&#39;</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">    }</span></span>
<span class="line"><span style="color:#E1E4E8;">  </span></span>
<span class="line"><span style="color:#E1E4E8;"> </span><span style="color:#6A737D;">//替换</span></span>
<span class="line"><span style="color:#E1E4E8;"> $patter </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&quot;/</span><span style="color:#DBEDFF;">&lt;a\s{1,2}class=</span><span style="color:#85E89D;font-weight:bold;">\&quot;</span><span style="color:#DBEDFF;">img-wrap</span><span style="color:#85E89D;font-weight:bold;">\&quot;</span><span style="color:#DBEDFF;">\s{1,2}data-size=</span><span style="color:#85E89D;font-weight:bold;">\&quot;</span><span style="color:#DBEDFF;">[0-9]{3}x[0-9]{3}</span><span style="color:#85E89D;font-weight:bold;">\&quot;</span><span style="color:#DBEDFF;">\s{1,2}href=</span><span style="color:#85E89D;font-weight:bold;">\&quot;</span><span style="color:#DBEDFF;">(.</span><span style="color:#F97583;">*</span><span style="color:#DBEDFF;">)</span><span style="color:#85E89D;font-weight:bold;">\&quot;</span><span style="color:#DBEDFF;">\s{1}width=</span><span style="color:#85E89D;font-weight:bold;">\&quot;</span><span style="color:#DBEDFF;">100%</span><span style="color:#85E89D;font-weight:bold;">\&quot;</span><span style="color:#DBEDFF;">\/&gt;&lt;\/a&gt;</span><span style="color:#9ECBFF;">/&quot;</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;"> $replace </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&quot;&lt;img src=</span><span style="color:#79B8FF;">\&quot;</span><span style="color:#9ECBFF;">$1</span><span style="color:#79B8FF;">\&quot;</span><span style="color:#9ECBFF;">  width=</span><span style="color:#79B8FF;">\&quot;</span><span style="color:#9ECBFF;">30%</span><span style="color:#79B8FF;">\&quot;</span><span style="color:#9ECBFF;">&gt;&lt;/img&gt;&quot;</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">echo</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">preg_replace</span><span style="color:#E1E4E8;">($patter,$replace,$str);</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#6A737D;">//判断</span></span>
<span class="line"><span style="color:#D73A49;">if</span><span style="color:#24292E;">(</span><span style="color:#D73A49;">!</span><span style="color:#005CC5;">preg_match</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot;/</span><span style="color:#D73A49;">^</span><span style="color:#032F62;">[1-9][0-9]{4,}</span><span style="color:#D73A49;">$</span><span style="color:#032F62;">/&quot;</span><span style="color:#24292E;">,$data_info[</span><span style="color:#032F62;">&#39;qq&#39;</span><span style="color:#24292E;">])){</span></span>
<span class="line"><span style="color:#24292E;">	$return_arr[</span><span style="color:#032F62;">&#39;code&#39;</span><span style="color:#24292E;">] </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">7</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">	$return_arr[</span><span style="color:#032F62;">&#39;msg&#39;</span><span style="color:#24292E;">] </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&#39;请填写正确qq号&#39;</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#005CC5;">echo</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">json_encode</span><span style="color:#24292E;">($return_arr);</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">die</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">} </span></span>
<span class="line"><span style="color:#6A737D;">//取内容</span></span>
<span class="line"><span style="color:#24292E;">$rule_mean </span><span style="color:#D73A49;">=</span><span style="color:#032F62;">&quot;/([\w]</span><span style="color:#D73A49;">+</span><span style="color:#032F62;">?).\s{0,4}(&lt;a\s{0,4}href=&#39;show-[\w]</span><span style="color:#D73A49;">+</span><span style="color:#032F62;">?\</span><span style="color:#D73A49;">+</span><span style="color:#032F62;">.{1,30}?-0.html&#39;&gt;&lt;font\s{0,4}color=olive&gt;&lt;u&gt;(.</span><span style="color:#D73A49;">*</span><span style="color:#032F62;">?)&lt;\/u&gt;&lt;\/font&gt;\s{0,4}&lt;\/a&gt;){1,}&lt;br&gt;/&quot;</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">if</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">preg_match_all</span><span style="color:#24292E;">($rule_mean,$content,$list_str)){</span></span>
<span class="line"><span style="color:#24292E;">		  </span><span style="color:#005CC5;">var_dump</span><span style="color:#24292E;">($list_str);</span></span>
<span class="line"><span style="color:#24292E;">    }</span><span style="color:#D73A49;">else</span><span style="color:#24292E;">{</span></span>
<span class="line"><span style="color:#24292E;">	    </span><span style="color:#005CC5;">echo</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&#39;mean not found&#39;</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">    }</span></span>
<span class="line"><span style="color:#24292E;">  </span></span>
<span class="line"><span style="color:#24292E;"> </span><span style="color:#6A737D;">//替换</span></span>
<span class="line"><span style="color:#24292E;"> $patter </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&quot;/&lt;a\s{1,2}class=</span><span style="color:#22863A;font-weight:bold;">\&quot;</span><span style="color:#032F62;">img-wrap</span><span style="color:#22863A;font-weight:bold;">\&quot;</span><span style="color:#032F62;">\s{1,2}data-size=</span><span style="color:#22863A;font-weight:bold;">\&quot;</span><span style="color:#032F62;">[0-9]{3}x[0-9]{3}</span><span style="color:#22863A;font-weight:bold;">\&quot;</span><span style="color:#032F62;">\s{1,2}href=</span><span style="color:#22863A;font-weight:bold;">\&quot;</span><span style="color:#032F62;">(.</span><span style="color:#D73A49;">*</span><span style="color:#032F62;">)</span><span style="color:#22863A;font-weight:bold;">\&quot;</span><span style="color:#032F62;">\s{1}width=</span><span style="color:#22863A;font-weight:bold;">\&quot;</span><span style="color:#032F62;">100%</span><span style="color:#22863A;font-weight:bold;">\&quot;</span><span style="color:#032F62;">\/&gt;&lt;\/a&gt;/&quot;</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;"> $replace </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&quot;&lt;img src=</span><span style="color:#005CC5;">\&quot;</span><span style="color:#032F62;">$1</span><span style="color:#005CC5;">\&quot;</span><span style="color:#032F62;">  width=</span><span style="color:#005CC5;">\&quot;</span><span style="color:#032F62;">30%</span><span style="color:#005CC5;">\&quot;</span><span style="color:#032F62;">&gt;&lt;/img&gt;&quot;</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;"> </span><span style="color:#005CC5;">echo</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">preg_replace</span><span style="color:#24292E;">($patter,$replace,$str);</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br></div></div><h2 id="数值处理类" tabindex="-1">数值处理类 <a class="header-anchor" href="#数值处理类" aria-label="Permalink to &quot;数值处理类&quot;">​</a></h2><div class="language-php vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">php</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#79B8FF;">is_numeric</span><span style="color:#E1E4E8;">($num) ;   </span><span style="color:#6A737D;">//是否数字</span></span>
<span class="line"><span style="color:#E1E4E8;">   </span><span style="color:#79B8FF;">echo</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">number_format</span><span style="color:#E1E4E8;">($grp_yc_all</span><span style="color:#F97583;">/</span><span style="color:#79B8FF;">100</span><span style="color:#E1E4E8;">,</span><span style="color:#9ECBFF;">&#39;2&#39;</span><span style="color:#E1E4E8;">,</span><span style="color:#9ECBFF;">&#39;.&#39;</span><span style="color:#E1E4E8;">,</span><span style="color:#9ECBFF;">&#39;,&#39;</span><span style="color:#E1E4E8;">);  </span><span style="color:#6A737D;">//保留两位小数</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292E;">    </span><span style="color:#005CC5;">is_numeric</span><span style="color:#24292E;">($num) ;   </span><span style="color:#6A737D;">//是否数字</span></span>
<span class="line"><span style="color:#24292E;">   </span><span style="color:#005CC5;">echo</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">number_format</span><span style="color:#24292E;">($grp_yc_all</span><span style="color:#D73A49;">/</span><span style="color:#005CC5;">100</span><span style="color:#24292E;">,</span><span style="color:#032F62;">&#39;2&#39;</span><span style="color:#24292E;">,</span><span style="color:#032F62;">&#39;.&#39;</span><span style="color:#24292E;">,</span><span style="color:#032F62;">&#39;,&#39;</span><span style="color:#24292E;">);  </span><span style="color:#6A737D;">//保留两位小数</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><ol><li>定义新对象</li></ol><div class="language-php vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">php</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#E1E4E8;">   $object </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">new</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">stdClass</span><span style="color:#E1E4E8;">();</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292E;">   $object </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">new</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">stdClass</span><span style="color:#24292E;">();</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br></div></div><ol><li>数组</li></ol><div class="language-php vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">php</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#E1E4E8;">      $id_Arr </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">explode</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;,&#39;</span><span style="color:#E1E4E8;">,$id); </span><span style="color:#79B8FF;">拆成数组</span><span style="color:#E1E4E8;"> </span></span>
<span class="line"><span style="color:#E1E4E8;">	  </span><span style="color:#79B8FF;">extract</span><span style="color:#E1E4E8;">($_GET);   </span><span style="color:#6A737D;">//打散数组</span></span>
<span class="line"><span style="color:#E1E4E8;">	  </span><span style="color:#79B8FF;">echo</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">implode</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot; &quot;</span><span style="color:#E1E4E8;">,</span><span style="color:#79B8FF;">array</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;Hello&#39;</span><span style="color:#E1E4E8;">,</span><span style="color:#9ECBFF;">&#39;World!&#39;</span><span style="color:#E1E4E8;">,</span><span style="color:#9ECBFF;">&#39;I&#39;</span><span style="color:#E1E4E8;">,</span><span style="color:#9ECBFF;">&#39;love&#39;</span><span style="color:#E1E4E8;">,</span><span style="color:#9ECBFF;">&#39;Shanghai!&#39;</span><span style="color:#E1E4E8;">)); </span><span style="color:#79B8FF;">拼字符串</span></span>
<span class="line"><span style="color:#E1E4E8;">         $filter</span><span style="color:#F97583;">=</span><span style="color:#79B8FF;">array_flip</span><span style="color:#E1E4E8;">($arr); </span><span style="color:#6A737D;">// 配合isset($filter[$v]) 判断是否包含在数组里比 in_array()提升效率</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292E;">      $id_Arr </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">explode</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;,&#39;</span><span style="color:#24292E;">,$id); </span><span style="color:#005CC5;">拆成数组</span><span style="color:#24292E;"> </span></span>
<span class="line"><span style="color:#24292E;">	  </span><span style="color:#005CC5;">extract</span><span style="color:#24292E;">($_GET);   </span><span style="color:#6A737D;">//打散数组</span></span>
<span class="line"><span style="color:#24292E;">	  </span><span style="color:#005CC5;">echo</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">implode</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot; &quot;</span><span style="color:#24292E;">,</span><span style="color:#005CC5;">array</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;Hello&#39;</span><span style="color:#24292E;">,</span><span style="color:#032F62;">&#39;World!&#39;</span><span style="color:#24292E;">,</span><span style="color:#032F62;">&#39;I&#39;</span><span style="color:#24292E;">,</span><span style="color:#032F62;">&#39;love&#39;</span><span style="color:#24292E;">,</span><span style="color:#032F62;">&#39;Shanghai!&#39;</span><span style="color:#24292E;">)); </span><span style="color:#005CC5;">拼字符串</span></span>
<span class="line"><span style="color:#24292E;">         $filter</span><span style="color:#D73A49;">=</span><span style="color:#005CC5;">array_flip</span><span style="color:#24292E;">($arr); </span><span style="color:#6A737D;">// 配合isset($filter[$v]) 判断是否包含在数组里比 in_array()提升效率</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><ol><li>文件处理</li></ol><div class="language-php vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">php</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#E1E4E8;">		</span><span style="color:#79B8FF;">is_file</span><span style="color:#E1E4E8;">($file_path); </span><span style="color:#6A737D;">//是否存在某文件</span></span>
<span class="line"><span style="color:#E1E4E8;">		</span><span style="color:#79B8FF;">is_dir</span><span style="color:#E1E4E8;">($dir_path); </span><span style="color:#6A737D;">//是否存在某目录</span></span>
<span class="line"><span style="color:#E1E4E8;">		</span><span style="color:#79B8FF;">mkdir</span><span style="color:#E1E4E8;">($dir_path,</span><span style="color:#9ECBFF;">&#39;0777&#39;</span><span style="color:#E1E4E8;">,</span><span style="color:#79B8FF;">true</span><span style="color:#E1E4E8;">) </span><span style="color:#6A737D;">//创建0777权限的目录</span></span>
<span class="line"><span style="color:#E1E4E8;">		</span><span style="color:#79B8FF;">pathinfo</span><span style="color:#E1E4E8;">($url);    </span><span style="color:#6A737D;">//获取文件拓展名，文件名，目录，文件名（不包含拓展名）的信息</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292E;">		</span><span style="color:#005CC5;">is_file</span><span style="color:#24292E;">($file_path); </span><span style="color:#6A737D;">//是否存在某文件</span></span>
<span class="line"><span style="color:#24292E;">		</span><span style="color:#005CC5;">is_dir</span><span style="color:#24292E;">($dir_path); </span><span style="color:#6A737D;">//是否存在某目录</span></span>
<span class="line"><span style="color:#24292E;">		</span><span style="color:#005CC5;">mkdir</span><span style="color:#24292E;">($dir_path,</span><span style="color:#032F62;">&#39;0777&#39;</span><span style="color:#24292E;">,</span><span style="color:#005CC5;">true</span><span style="color:#24292E;">) </span><span style="color:#6A737D;">//创建0777权限的目录</span></span>
<span class="line"><span style="color:#24292E;">		</span><span style="color:#005CC5;">pathinfo</span><span style="color:#24292E;">($url);    </span><span style="color:#6A737D;">//获取文件拓展名，文件名，目录，文件名（不包含拓展名）的信息</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><ol><li>操作类</li></ol><div class="language-php vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">php</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#6A737D;">//远程下载图像到本地</span></span>
<span class="line"><span style="color:#E1E4E8;">	$content </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">file_get_contents</span><span style="color:#E1E4E8;">($head);</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#79B8FF;">file_put_contents</span><span style="color:#E1E4E8;">($save_to,$content);</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#6A737D;">/**</span></span>
<span class="line"><span style="color:#6A737D;">	*功能：https post请求</span></span>
<span class="line"><span style="color:#6A737D;">	*参数：$url</span></span>
<span class="line"><span style="color:#6A737D;">	*参数：$data = &#39;user_id=&#39;.$_SESSION[&#39;user_id&#39;].&#39;&amp;token=&#39;.$_SESSION[&#39;token&#39;];</span></span>
<span class="line"><span style="color:#6A737D;">	*/</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">function</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">httpspost</span><span style="color:#E1E4E8;">($url,$data){</span></span>
<span class="line"><span style="color:#E1E4E8;">		 $ch </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">curl_init</span><span style="color:#E1E4E8;">();</span></span>
<span class="line"><span style="color:#E1E4E8;">		 </span><span style="color:#79B8FF;">curl_setopt</span><span style="color:#E1E4E8;">($ch, </span><span style="color:#79B8FF;">CURLOPT_URL</span><span style="color:#E1E4E8;">, $url);</span></span>
<span class="line"><span style="color:#E1E4E8;">		 </span><span style="color:#79B8FF;">curl_setopt</span><span style="color:#E1E4E8;">($ch, </span><span style="color:#79B8FF;">CURLOPT_CUSTOMREQUEST</span><span style="color:#E1E4E8;">, </span><span style="color:#9ECBFF;">&quot;POST&quot;</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">		 </span><span style="color:#79B8FF;">curl_setopt</span><span style="color:#E1E4E8;">($ch, </span><span style="color:#79B8FF;">CURLOPT_SSL_VERIFYPEER</span><span style="color:#E1E4E8;">, </span><span style="color:#79B8FF;">FALSE</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">		 </span><span style="color:#79B8FF;">curl_setopt</span><span style="color:#E1E4E8;">($ch, </span><span style="color:#79B8FF;">CURLOPT_SSL_VERIFYHOST</span><span style="color:#E1E4E8;">, </span><span style="color:#79B8FF;">FALSE</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">		 </span><span style="color:#79B8FF;">curl_setopt</span><span style="color:#E1E4E8;">($ch, </span><span style="color:#79B8FF;">CURLOPT_USERAGENT</span><span style="color:#E1E4E8;">, </span><span style="color:#9ECBFF;">&#39;Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0&#39;</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">		 </span><span style="color:#79B8FF;">curl_setopt</span><span style="color:#E1E4E8;">($ch, </span><span style="color:#79B8FF;">CURLOPT_FOLLOWLOCATION</span><span style="color:#E1E4E8;">, </span><span style="color:#79B8FF;">1</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">		 </span><span style="color:#79B8FF;">curl_setopt</span><span style="color:#E1E4E8;">($ch, </span><span style="color:#79B8FF;">CURLOPT_AUTOREFERER</span><span style="color:#E1E4E8;">, </span><span style="color:#79B8FF;">1</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">		 </span><span style="color:#79B8FF;">curl_setopt</span><span style="color:#E1E4E8;">($ch, </span><span style="color:#79B8FF;">CURLOPT_POSTFIELDS</span><span style="color:#E1E4E8;">, $data);</span></span>
<span class="line"><span style="color:#E1E4E8;">                 </span><span style="color:#79B8FF;">curl_setopt</span><span style="color:#E1E4E8;">($ch, </span><span style="color:#79B8FF;">CURLOPT_TIMEOUT</span><span style="color:#E1E4E8;">,</span><span style="color:#79B8FF;">6</span><span style="color:#E1E4E8;">);</span><span style="color:#6A737D;">//设置超时</span></span>
<span class="line"><span style="color:#E1E4E8;">		 </span><span style="color:#79B8FF;">curl_setopt</span><span style="color:#E1E4E8;">($ch, </span><span style="color:#79B8FF;">CURLOPT_RETURNTRANSFER</span><span style="color:#E1E4E8;">, </span><span style="color:#79B8FF;">true</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">		 $tmpInfo </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">curl_exec</span><span style="color:#E1E4E8;">($ch);</span></span>
<span class="line"><span style="color:#E1E4E8;">		 </span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;"> (</span><span style="color:#79B8FF;">curl_errno</span><span style="color:#E1E4E8;">($ch)) {</span></span>
<span class="line"><span style="color:#E1E4E8;">		  </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">curl_error</span><span style="color:#E1E4E8;">($ch);</span></span>
<span class="line"><span style="color:#E1E4E8;">		 }</span></span>
<span class="line"><span style="color:#E1E4E8;">		 </span><span style="color:#79B8FF;">curl_close</span><span style="color:#E1E4E8;">($ch);</span></span>
<span class="line"><span style="color:#E1E4E8;">		 </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> $tmpInfo;</span></span>
<span class="line"><span style="color:#E1E4E8;">	}</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#6A737D;">/**</span></span>
<span class="line"><span style="color:#6A737D;">	*功能：https GET请求</span></span>
<span class="line"><span style="color:#6A737D;">	*参数：$url</span></span>
<span class="line"><span style="color:#6A737D;">	*参数：$data</span></span>
<span class="line"><span style="color:#6A737D;">	*/</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">function</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">httpsget</span><span style="color:#E1E4E8;">($url){</span></span>
<span class="line"><span style="color:#E1E4E8;">		 $ch </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">curl_init</span><span style="color:#E1E4E8;">();</span></span>
<span class="line"><span style="color:#E1E4E8;">		 </span><span style="color:#79B8FF;">curl_setopt</span><span style="color:#E1E4E8;">($ch, </span><span style="color:#79B8FF;">CURLOPT_URL</span><span style="color:#E1E4E8;">, $url);</span></span>
<span class="line"><span style="color:#E1E4E8;">		 </span><span style="color:#79B8FF;">curl_setopt</span><span style="color:#E1E4E8;">($ch, </span><span style="color:#79B8FF;">CURLOPT_SSL_VERIFYPEER</span><span style="color:#E1E4E8;">, </span><span style="color:#79B8FF;">FALSE</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">		 </span><span style="color:#79B8FF;">curl_setopt</span><span style="color:#E1E4E8;">($ch, </span><span style="color:#79B8FF;">CURLOPT_SSL_VERIFYHOST</span><span style="color:#E1E4E8;">, </span><span style="color:#79B8FF;">FALSE</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">		 </span><span style="color:#79B8FF;">curl_setopt</span><span style="color:#E1E4E8;">($ch, </span><span style="color:#79B8FF;">CURLOPT_USERAGENT</span><span style="color:#E1E4E8;">, </span><span style="color:#9ECBFF;">&#39;Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0&#39;</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">		 </span><span style="color:#79B8FF;">curl_setopt</span><span style="color:#E1E4E8;">($ch, </span><span style="color:#79B8FF;">CURLOPT_FOLLOWLOCATION</span><span style="color:#E1E4E8;">, </span><span style="color:#79B8FF;">1</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">		 </span><span style="color:#79B8FF;">curl_setopt</span><span style="color:#E1E4E8;">($ch, </span><span style="color:#79B8FF;">CURLOPT_AUTOREFERER</span><span style="color:#E1E4E8;">, </span><span style="color:#79B8FF;">1</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">                 </span><span style="color:#79B8FF;">curl_setopt</span><span style="color:#E1E4E8;">($ch, </span><span style="color:#79B8FF;">CURLOPT_TIMEOUT</span><span style="color:#E1E4E8;">,</span><span style="color:#79B8FF;">6</span><span style="color:#E1E4E8;">);</span><span style="color:#6A737D;">//设置超时</span></span>
<span class="line"><span style="color:#E1E4E8;">		 </span><span style="color:#79B8FF;">curl_setopt</span><span style="color:#E1E4E8;">($ch, </span><span style="color:#79B8FF;">CURLOPT_RETURNTRANSFER</span><span style="color:#E1E4E8;">, </span><span style="color:#79B8FF;">true</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">		 $tmpInfo </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">curl_exec</span><span style="color:#E1E4E8;">($ch);</span></span>
<span class="line"><span style="color:#E1E4E8;">		 </span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;"> (</span><span style="color:#79B8FF;">curl_errno</span><span style="color:#E1E4E8;">($ch)) {</span></span>
<span class="line"><span style="color:#E1E4E8;">		  </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">curl_error</span><span style="color:#E1E4E8;">($ch);</span></span>
<span class="line"><span style="color:#E1E4E8;">		 }</span></span>
<span class="line"><span style="color:#E1E4E8;">		 </span><span style="color:#79B8FF;">curl_close</span><span style="color:#E1E4E8;">($ch);</span></span>
<span class="line"><span style="color:#E1E4E8;">		 </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> $tmpInfo;</span></span>
<span class="line"><span style="color:#E1E4E8;">	}</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292E;">	</span><span style="color:#6A737D;">//远程下载图像到本地</span></span>
<span class="line"><span style="color:#24292E;">	$content </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">file_get_contents</span><span style="color:#24292E;">($head);</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#005CC5;">file_put_contents</span><span style="color:#24292E;">($save_to,$content);</span></span>
<span class="line"><span style="color:#24292E;">	</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#6A737D;">/**</span></span>
<span class="line"><span style="color:#6A737D;">	*功能：https post请求</span></span>
<span class="line"><span style="color:#6A737D;">	*参数：$url</span></span>
<span class="line"><span style="color:#6A737D;">	*参数：$data = &#39;user_id=&#39;.$_SESSION[&#39;user_id&#39;].&#39;&amp;token=&#39;.$_SESSION[&#39;token&#39;];</span></span>
<span class="line"><span style="color:#6A737D;">	*/</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">public</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">function</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">httpspost</span><span style="color:#24292E;">($url,$data){</span></span>
<span class="line"><span style="color:#24292E;">		 $ch </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">curl_init</span><span style="color:#24292E;">();</span></span>
<span class="line"><span style="color:#24292E;">		 </span><span style="color:#005CC5;">curl_setopt</span><span style="color:#24292E;">($ch, </span><span style="color:#005CC5;">CURLOPT_URL</span><span style="color:#24292E;">, $url);</span></span>
<span class="line"><span style="color:#24292E;">		 </span><span style="color:#005CC5;">curl_setopt</span><span style="color:#24292E;">($ch, </span><span style="color:#005CC5;">CURLOPT_CUSTOMREQUEST</span><span style="color:#24292E;">, </span><span style="color:#032F62;">&quot;POST&quot;</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">		 </span><span style="color:#005CC5;">curl_setopt</span><span style="color:#24292E;">($ch, </span><span style="color:#005CC5;">CURLOPT_SSL_VERIFYPEER</span><span style="color:#24292E;">, </span><span style="color:#005CC5;">FALSE</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">		 </span><span style="color:#005CC5;">curl_setopt</span><span style="color:#24292E;">($ch, </span><span style="color:#005CC5;">CURLOPT_SSL_VERIFYHOST</span><span style="color:#24292E;">, </span><span style="color:#005CC5;">FALSE</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">		 </span><span style="color:#005CC5;">curl_setopt</span><span style="color:#24292E;">($ch, </span><span style="color:#005CC5;">CURLOPT_USERAGENT</span><span style="color:#24292E;">, </span><span style="color:#032F62;">&#39;Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0&#39;</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">		 </span><span style="color:#005CC5;">curl_setopt</span><span style="color:#24292E;">($ch, </span><span style="color:#005CC5;">CURLOPT_FOLLOWLOCATION</span><span style="color:#24292E;">, </span><span style="color:#005CC5;">1</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">		 </span><span style="color:#005CC5;">curl_setopt</span><span style="color:#24292E;">($ch, </span><span style="color:#005CC5;">CURLOPT_AUTOREFERER</span><span style="color:#24292E;">, </span><span style="color:#005CC5;">1</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">		 </span><span style="color:#005CC5;">curl_setopt</span><span style="color:#24292E;">($ch, </span><span style="color:#005CC5;">CURLOPT_POSTFIELDS</span><span style="color:#24292E;">, $data);</span></span>
<span class="line"><span style="color:#24292E;">                 </span><span style="color:#005CC5;">curl_setopt</span><span style="color:#24292E;">($ch, </span><span style="color:#005CC5;">CURLOPT_TIMEOUT</span><span style="color:#24292E;">,</span><span style="color:#005CC5;">6</span><span style="color:#24292E;">);</span><span style="color:#6A737D;">//设置超时</span></span>
<span class="line"><span style="color:#24292E;">		 </span><span style="color:#005CC5;">curl_setopt</span><span style="color:#24292E;">($ch, </span><span style="color:#005CC5;">CURLOPT_RETURNTRANSFER</span><span style="color:#24292E;">, </span><span style="color:#005CC5;">true</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">		 $tmpInfo </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">curl_exec</span><span style="color:#24292E;">($ch);</span></span>
<span class="line"><span style="color:#24292E;">		 </span><span style="color:#D73A49;">if</span><span style="color:#24292E;"> (</span><span style="color:#005CC5;">curl_errno</span><span style="color:#24292E;">($ch)) {</span></span>
<span class="line"><span style="color:#24292E;">		  </span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">curl_error</span><span style="color:#24292E;">($ch);</span></span>
<span class="line"><span style="color:#24292E;">		 }</span></span>
<span class="line"><span style="color:#24292E;">		 </span><span style="color:#005CC5;">curl_close</span><span style="color:#24292E;">($ch);</span></span>
<span class="line"><span style="color:#24292E;">		 </span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> $tmpInfo;</span></span>
<span class="line"><span style="color:#24292E;">	}</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#6A737D;">/**</span></span>
<span class="line"><span style="color:#6A737D;">	*功能：https GET请求</span></span>
<span class="line"><span style="color:#6A737D;">	*参数：$url</span></span>
<span class="line"><span style="color:#6A737D;">	*参数：$data</span></span>
<span class="line"><span style="color:#6A737D;">	*/</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">public</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">function</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">httpsget</span><span style="color:#24292E;">($url){</span></span>
<span class="line"><span style="color:#24292E;">		 $ch </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">curl_init</span><span style="color:#24292E;">();</span></span>
<span class="line"><span style="color:#24292E;">		 </span><span style="color:#005CC5;">curl_setopt</span><span style="color:#24292E;">($ch, </span><span style="color:#005CC5;">CURLOPT_URL</span><span style="color:#24292E;">, $url);</span></span>
<span class="line"><span style="color:#24292E;">		 </span><span style="color:#005CC5;">curl_setopt</span><span style="color:#24292E;">($ch, </span><span style="color:#005CC5;">CURLOPT_SSL_VERIFYPEER</span><span style="color:#24292E;">, </span><span style="color:#005CC5;">FALSE</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">		 </span><span style="color:#005CC5;">curl_setopt</span><span style="color:#24292E;">($ch, </span><span style="color:#005CC5;">CURLOPT_SSL_VERIFYHOST</span><span style="color:#24292E;">, </span><span style="color:#005CC5;">FALSE</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">		 </span><span style="color:#005CC5;">curl_setopt</span><span style="color:#24292E;">($ch, </span><span style="color:#005CC5;">CURLOPT_USERAGENT</span><span style="color:#24292E;">, </span><span style="color:#032F62;">&#39;Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0&#39;</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">		 </span><span style="color:#005CC5;">curl_setopt</span><span style="color:#24292E;">($ch, </span><span style="color:#005CC5;">CURLOPT_FOLLOWLOCATION</span><span style="color:#24292E;">, </span><span style="color:#005CC5;">1</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">		 </span><span style="color:#005CC5;">curl_setopt</span><span style="color:#24292E;">($ch, </span><span style="color:#005CC5;">CURLOPT_AUTOREFERER</span><span style="color:#24292E;">, </span><span style="color:#005CC5;">1</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">                 </span><span style="color:#005CC5;">curl_setopt</span><span style="color:#24292E;">($ch, </span><span style="color:#005CC5;">CURLOPT_TIMEOUT</span><span style="color:#24292E;">,</span><span style="color:#005CC5;">6</span><span style="color:#24292E;">);</span><span style="color:#6A737D;">//设置超时</span></span>
<span class="line"><span style="color:#24292E;">		 </span><span style="color:#005CC5;">curl_setopt</span><span style="color:#24292E;">($ch, </span><span style="color:#005CC5;">CURLOPT_RETURNTRANSFER</span><span style="color:#24292E;">, </span><span style="color:#005CC5;">true</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">		 $tmpInfo </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">curl_exec</span><span style="color:#24292E;">($ch);</span></span>
<span class="line"><span style="color:#24292E;">		 </span><span style="color:#D73A49;">if</span><span style="color:#24292E;"> (</span><span style="color:#005CC5;">curl_errno</span><span style="color:#24292E;">($ch)) {</span></span>
<span class="line"><span style="color:#24292E;">		  </span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">curl_error</span><span style="color:#24292E;">($ch);</span></span>
<span class="line"><span style="color:#24292E;">		 }</span></span>
<span class="line"><span style="color:#24292E;">		 </span><span style="color:#005CC5;">curl_close</span><span style="color:#24292E;">($ch);</span></span>
<span class="line"><span style="color:#24292E;">		 </span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> $tmpInfo;</span></span>
<span class="line"><span style="color:#24292E;">	}</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br><span class="line-number">33</span><br><span class="line-number">34</span><br><span class="line-number">35</span><br><span class="line-number">36</span><br><span class="line-number">37</span><br><span class="line-number">38</span><br><span class="line-number">39</span><br><span class="line-number">40</span><br><span class="line-number">41</span><br><span class="line-number">42</span><br><span class="line-number">43</span><br><span class="line-number">44</span><br><span class="line-number">45</span><br><span class="line-number">46</span><br><span class="line-number">47</span><br><span class="line-number">48</span><br><span class="line-number">49</span><br><span class="line-number">50</span><br></div></div><h1 id="自定义方法" tabindex="-1">自定义方法 <a class="header-anchor" href="#自定义方法" aria-label="Permalink to &quot;自定义方法&quot;">​</a></h1><div class="language-php vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">php</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#6A737D;">//去除数组或对象中的null值，改为空字符（用于接口返回数据）</span></span>
<span class="line"><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">private</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">function</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">check_null</span><span style="color:#E1E4E8;">($object){</span></span>
<span class="line"><span style="color:#E1E4E8;">		$object </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">json_encode</span><span style="color:#E1E4E8;">($object);</span></span>
<span class="line"><span style="color:#E1E4E8;">		$object </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">str_replace</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;null&#39;</span><span style="color:#E1E4E8;">,</span><span style="color:#9ECBFF;">&#39;&quot;&quot;&#39;</span><span style="color:#E1E4E8;">,$object);</span></span>
<span class="line"><span style="color:#E1E4E8;">		$object </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">json_decode</span><span style="color:#E1E4E8;">($object);</span></span>
<span class="line"><span style="color:#E1E4E8;">		</span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> $object;</span></span>
<span class="line"><span style="color:#E1E4E8;">	}</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span></span>
<span class="line"><span style="color:#6A737D;">/*</span></span>
<span class="line"><span style="color:#6A737D;">//把时间转换为几小时前/几秒前样式</span></span>
<span class="line"><span style="color:#6A737D;">*/</span></span>
<span class="line"><span style="color:#6A737D;">//处理时间</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">private</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">function</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">time_tranx</span><span style="color:#E1E4E8;">($the_time){  </span></span>
<span class="line"><span style="color:#E1E4E8;">	   $now_time </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">date</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot;Y-m-d H:i:s&quot;</span><span style="color:#E1E4E8;">,</span><span style="color:#79B8FF;">time</span><span style="color:#E1E4E8;">()</span><span style="color:#F97583;">+</span><span style="color:#79B8FF;">8</span><span style="color:#F97583;">*</span><span style="color:#79B8FF;">60</span><span style="color:#F97583;">*</span><span style="color:#79B8FF;">60</span><span style="color:#E1E4E8;">);  </span></span>
<span class="line"><span style="color:#E1E4E8;">	   $now_time </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">strtotime</span><span style="color:#E1E4E8;">($now_time);  </span></span>
<span class="line"><span style="color:#E1E4E8;">	   $show_time </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">strtotime</span><span style="color:#E1E4E8;">($the_time);  </span></span>
<span class="line"><span style="color:#E1E4E8;">	   $dur </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $now_time </span><span style="color:#F97583;">-</span><span style="color:#E1E4E8;"> $show_time;</span></span>
<span class="line"><span style="color:#E1E4E8;">		</span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;"> ($dur </span><span style="color:#F97583;">&lt;</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">60</span><span style="color:#E1E4E8;">) {  </span></span>
<span class="line"><span style="color:#E1E4E8;">            </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> $dur </span><span style="color:#F97583;">.</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&#39;秒前&#39;</span><span style="color:#E1E4E8;">;  </span></span>
<span class="line"><span style="color:#E1E4E8;">        }</span><span style="color:#F97583;">elseif</span><span style="color:#E1E4E8;"> ($dur </span><span style="color:#F97583;">&lt;</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">3600</span><span style="color:#E1E4E8;">) {   </span></span>
<span class="line"><span style="color:#E1E4E8;">            </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">floor</span><span style="color:#E1E4E8;">($dur</span><span style="color:#F97583;">/</span><span style="color:#79B8FF;">60</span><span style="color:#E1E4E8;">) </span><span style="color:#F97583;">.</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&#39;分钟前&#39;</span><span style="color:#E1E4E8;">;  </span></span>
<span class="line"><span style="color:#E1E4E8;">        }</span><span style="color:#F97583;">elseif</span><span style="color:#E1E4E8;">($dur </span><span style="color:#F97583;">&lt;</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">86400</span><span style="color:#E1E4E8;">){  </span></span>
<span class="line"><span style="color:#E1E4E8;">			</span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">floor</span><span style="color:#E1E4E8;">($dur</span><span style="color:#F97583;">/</span><span style="color:#79B8FF;">3600</span><span style="color:#E1E4E8;">)</span><span style="color:#F97583;">.</span><span style="color:#9ECBFF;">&#39;小时前&#39;</span><span style="color:#E1E4E8;">;  </span></span>
<span class="line"><span style="color:#E1E4E8;">		}</span><span style="color:#F97583;">elseif</span><span style="color:#E1E4E8;">($dur </span><span style="color:#F97583;">&lt;</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">259200</span><span style="color:#E1E4E8;">){ </span><span style="color:#6A737D;">//3天内  </span></span>
<span class="line"><span style="color:#E1E4E8;">			</span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">floor</span><span style="color:#E1E4E8;">($dur</span><span style="color:#F97583;">/</span><span style="color:#79B8FF;">86400</span><span style="color:#E1E4E8;">)</span><span style="color:#F97583;">.</span><span style="color:#9ECBFF;">&#39;天前&#39;</span><span style="color:#E1E4E8;">;  </span></span>
<span class="line"><span style="color:#E1E4E8;">		}</span><span style="color:#F97583;">elseif</span><span style="color:#E1E4E8;">($dur </span><span style="color:#F97583;">&lt;</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">604800</span><span style="color:#E1E4E8;">){  </span></span>
<span class="line"><span style="color:#E1E4E8;">			</span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&#39;3天前&#39;</span><span style="color:#E1E4E8;">;  </span></span>
<span class="line"><span style="color:#E1E4E8;">		}</span><span style="color:#F97583;">else</span><span style="color:#E1E4E8;">{  </span></span>
<span class="line"><span style="color:#E1E4E8;">			</span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">substr</span><span style="color:#E1E4E8;">($the_time,</span><span style="color:#79B8FF;">0</span><span style="color:#E1E4E8;">,</span><span style="color:#79B8FF;">10</span><span style="color:#E1E4E8;">);  </span></span>
<span class="line"><span style="color:#E1E4E8;">		}   </span></span>
<span class="line"><span style="color:#E1E4E8;">	}  </span></span>
<span class="line"><span style="color:#E1E4E8;"> </span><span style="color:#6A737D;">/**</span></span>
<span class="line"><span style="color:#6A737D;"> * 将秒时间转换成天 小时 分 秒</span></span>
<span class="line"><span style="color:#6A737D;"> * </span><span style="color:#F97583;">@author</span><span style="color:#6A737D;"> mmy</span></span>
<span class="line"><span style="color:#6A737D;"> * </span><span style="color:#F97583;">@param</span><span style="color:#6A737D;"> $second</span></span>
<span class="line"><span style="color:#6A737D;"> * </span><span style="color:#F97583;">@return</span><span style="color:#6A737D;"> </span><span style="color:#F97583;">string</span></span>
<span class="line"><span style="color:#6A737D;"> */</span></span>
<span class="line"><span style="color:#F97583;">function</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">time2string</span><span style="color:#E1E4E8;">($second){</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;">($second</span><span style="color:#F97583;">&lt;=</span><span style="color:#79B8FF;">0</span><span style="color:#E1E4E8;">){</span></span>
<span class="line"><span style="color:#E1E4E8;">		</span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&#39;0秒&#39;</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">	} </span></span>
<span class="line"><span style="color:#E1E4E8;">	$day </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">floor</span><span style="color:#E1E4E8;">($second</span><span style="color:#F97583;">/</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">3600</span><span style="color:#F97583;">*</span><span style="color:#79B8FF;">24</span><span style="color:#E1E4E8;">));</span></span>
<span class="line"><span style="color:#E1E4E8;">	$second </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $second</span><span style="color:#F97583;">%</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">3600</span><span style="color:#F97583;">*</span><span style="color:#79B8FF;">24</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">	$hour </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">floor</span><span style="color:#E1E4E8;">($second</span><span style="color:#F97583;">/</span><span style="color:#79B8FF;">3600</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">	$second </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $second</span><span style="color:#F97583;">%</span><span style="color:#79B8FF;">3600</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">	$minute </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">floor</span><span style="color:#E1E4E8;">($second</span><span style="color:#F97583;">/</span><span style="color:#79B8FF;">60</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">	$second </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $second</span><span style="color:#F97583;">%</span><span style="color:#79B8FF;">60</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">	$str</span><span style="color:#F97583;">=</span><span style="color:#9ECBFF;">&#39;&#39;</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;">(</span><span style="color:#F97583;">!</span><span style="color:#79B8FF;">empty</span><span style="color:#E1E4E8;">($day)){</span></span>
<span class="line"><span style="color:#E1E4E8;">		$str</span><span style="color:#F97583;">.=</span><span style="color:#E1E4E8;">$day</span><span style="color:#F97583;">.</span><span style="color:#9ECBFF;">&quot;天&quot;</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">	}</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;">(</span><span style="color:#F97583;">!</span><span style="color:#79B8FF;">empty</span><span style="color:#E1E4E8;">($hour)){</span></span>
<span class="line"><span style="color:#E1E4E8;">		$str</span><span style="color:#F97583;">.=</span><span style="color:#E1E4E8;">$hour</span><span style="color:#F97583;">.</span><span style="color:#9ECBFF;">&quot;时&quot;</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">	}</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;">(</span><span style="color:#F97583;">!</span><span style="color:#79B8FF;">empty</span><span style="color:#E1E4E8;">($minute)){</span></span>
<span class="line"><span style="color:#E1E4E8;">		$str</span><span style="color:#F97583;">.=</span><span style="color:#E1E4E8;">$minute</span><span style="color:#F97583;">.</span><span style="color:#9ECBFF;">&quot;分&quot;</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">	}</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;">(</span><span style="color:#F97583;">!</span><span style="color:#79B8FF;">empty</span><span style="color:#E1E4E8;">($second)){</span></span>
<span class="line"><span style="color:#E1E4E8;">		$str</span><span style="color:#F97583;">.=</span><span style="color:#E1E4E8;">$second</span><span style="color:#F97583;">.</span><span style="color:#9ECBFF;">&quot;秒&quot;</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">	}</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> $str;</span></span>
<span class="line"><span style="color:#E1E4E8;">}</span></span>
<span class="line"><span style="color:#6A737D;">//转义特殊字符</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">function</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">format_html</span><span style="color:#E1E4E8;">($str){</span></span>
<span class="line"><span style="color:#E1E4E8;">		$str </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">strip_tags</span><span style="color:#E1E4E8;">($str);</span></span>
<span class="line"><span style="color:#E1E4E8;">		$str </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">str_replace</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">array</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot;</span><span style="color:#79B8FF;">\r\n</span><span style="color:#9ECBFF;">&quot;</span><span style="color:#E1E4E8;">, </span><span style="color:#9ECBFF;">&quot;</span><span style="color:#79B8FF;">\r</span><span style="color:#9ECBFF;">&quot;</span><span style="color:#E1E4E8;">, </span><span style="color:#9ECBFF;">&quot;</span><span style="color:#79B8FF;">\n</span><span style="color:#9ECBFF;">&quot;</span><span style="color:#E1E4E8;">,</span><span style="color:#9ECBFF;">&quot;</span><span style="color:#79B8FF;">\t</span><span style="color:#9ECBFF;">&quot;</span><span style="color:#E1E4E8;">), </span><span style="color:#9ECBFF;">&quot;&quot;</span><span style="color:#E1E4E8;">, $str); </span></span>
<span class="line"><span style="color:#E1E4E8;">		$str </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">str_replace</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;&amp;ldquo;&#39;</span><span style="color:#E1E4E8;">, </span><span style="color:#9ECBFF;">&#39;“&#39;</span><span style="color:#E1E4E8;">,$str);</span></span>
<span class="line"><span style="color:#E1E4E8;">		$str </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">str_replace</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;&amp;rdquo;&#39;</span><span style="color:#E1E4E8;">, </span><span style="color:#9ECBFF;">&#39;”&#39;</span><span style="color:#E1E4E8;">,$str);</span></span>
<span class="line"><span style="color:#E1E4E8;">		$str </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">str_replace</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;&amp;middot;&#39;</span><span style="color:#E1E4E8;">, </span><span style="color:#9ECBFF;">&#39;·&#39;</span><span style="color:#E1E4E8;">,$str);</span></span>
<span class="line"><span style="color:#E1E4E8;">		$str </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">str_replace</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;&amp;lsquo;&#39;</span><span style="color:#E1E4E8;">, </span><span style="color:#9ECBFF;">&#39;‘&#39;</span><span style="color:#E1E4E8;">,$str);</span></span>
<span class="line"><span style="color:#E1E4E8;">		$str </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">str_replace</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;&amp;rsquo;&#39;</span><span style="color:#E1E4E8;">, </span><span style="color:#9ECBFF;">&#39;’&#39;</span><span style="color:#E1E4E8;">,$str);</span></span>
<span class="line"><span style="color:#E1E4E8;">		$str </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">str_replace</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;&amp;hellip;&#39;</span><span style="color:#E1E4E8;">, </span><span style="color:#9ECBFF;">&#39;…&#39;</span><span style="color:#E1E4E8;">, $str);</span></span>
<span class="line"><span style="color:#E1E4E8;">		$str </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">str_replace</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;&amp;mdash;&#39;</span><span style="color:#E1E4E8;">, </span><span style="color:#9ECBFF;">&#39;—&#39;</span><span style="color:#E1E4E8;">, $str);</span></span>
<span class="line"><span style="color:#E1E4E8;">		</span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> $str;</span></span>
<span class="line"><span style="color:#E1E4E8;">	}</span></span>
<span class="line"><span style="color:#6A737D;">//计算字符</span></span>
<span class="line"><span style="color:#F97583;">function</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">word_count</span><span style="color:#E1E4E8;">($con){</span></span>
<span class="line"><span style="color:#E1E4E8;">		</span></span>
<span class="line"><span style="color:#E1E4E8;">	$con </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">str_replace</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot;,&quot;</span><span style="color:#E1E4E8;">,</span><span style="color:#9ECBFF;">&quot; &quot;</span><span style="color:#E1E4E8;">,$con);</span></span>
<span class="line"><span style="color:#E1E4E8;">	$con </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">str_replace</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot;.&quot;</span><span style="color:#E1E4E8;">,</span><span style="color:#9ECBFF;">&quot; &quot;</span><span style="color:#E1E4E8;">,$con); </span></span>
<span class="line"><span style="color:#E1E4E8;">	$con </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">preg_replace</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot;/</span><span style="color:#DBEDFF;">\s</span><span style="color:#F97583;">+</span><span style="color:#9ECBFF;">/&quot;</span><span style="color:#E1E4E8;">,</span><span style="color:#9ECBFF;">&quot; &quot;</span><span style="color:#E1E4E8;">,$con);</span></span>
<span class="line"><span style="color:#E1E4E8;">	$array </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">explode</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot; &quot;</span><span style="color:#E1E4E8;">, $con);  </span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">count</span><span style="color:#E1E4E8;">($array);</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E1E4E8;">}</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span></span>
<span class="line"><span style="color:#6A737D;">/*</span></span>
<span class="line"><span style="color:#6A737D;">Utf-8、gb2312都支持的汉字截取函数</span></span>
<span class="line"><span style="color:#6A737D;">cut_str(字符串, 截取长度, 开始长度, 编码);</span></span>
<span class="line"><span style="color:#6A737D;">编码默认为 utf-8</span></span>
<span class="line"><span style="color:#6A737D;">开始长度默认为 0</span></span>
<span class="line"><span style="color:#6A737D;">*/</span></span>
<span class="line"></span>
<span class="line"><span style="color:#F97583;">function</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">cut_str</span><span style="color:#E1E4E8;">($sourcestr, $cutlength)</span></span>
<span class="line"><span style="color:#E1E4E8;">{</span></span>
<span class="line"><span style="color:#E1E4E8;">   $sourcestr</span><span style="color:#F97583;">=</span><span style="color:#79B8FF;">strip_tags</span><span style="color:#E1E4E8;">($sourcestr);</span></span>
<span class="line"><span style="color:#E1E4E8;">	$returnstr </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&#39;&#39;</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">	   $i </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">0</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">	   $n </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">0</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">	   $str_length </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">strlen</span><span style="color:#E1E4E8;"> ( $sourcestr ); </span><span style="color:#6A737D;">//字符串的字节数 </span></span>
<span class="line"><span style="color:#E1E4E8;">	   </span><span style="color:#F97583;">while</span><span style="color:#E1E4E8;"> ( ($n </span><span style="color:#F97583;">&lt;</span><span style="color:#E1E4E8;"> $cutlength) </span><span style="color:#F97583;">and</span><span style="color:#E1E4E8;"> ($i </span><span style="color:#F97583;">&lt;=</span><span style="color:#E1E4E8;"> $str_length) ) {</span></span>
<span class="line"><span style="color:#E1E4E8;">		$temp_str </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">substr</span><span style="color:#E1E4E8;"> ( $sourcestr, $i, </span><span style="color:#79B8FF;">1</span><span style="color:#E1E4E8;"> );</span></span>
<span class="line"><span style="color:#E1E4E8;">		$ascnum </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">Ord</span><span style="color:#E1E4E8;"> ( $temp_str ); </span><span style="color:#6A737D;">//得到字符串中第$i位字符的ascii码 </span></span>
<span class="line"><span style="color:#E1E4E8;">		</span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;"> ($ascnum </span><span style="color:#F97583;">&gt;=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">224</span><span style="color:#E1E4E8;">) {</span><span style="color:#6A737D;">//如果ASCII位高与224，</span></span>
<span class="line"><span style="color:#E1E4E8;">		   $returnstr </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $returnstr </span><span style="color:#F97583;">.</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">substr</span><span style="color:#E1E4E8;"> ( $sourcestr, $i, </span><span style="color:#79B8FF;">3</span><span style="color:#E1E4E8;"> ); </span><span style="color:#6A737D;">//根据UTF-8编码规范，将3个连续的字符计为单个字符  </span></span>
<span class="line"><span style="color:#E1E4E8;">		   $i </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $i </span><span style="color:#F97583;">+</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">3</span><span style="color:#E1E4E8;">; </span><span style="color:#6A737D;">//实际Byte计为3</span></span>
<span class="line"><span style="color:#E1E4E8;">		   $n </span><span style="color:#F97583;">++</span><span style="color:#E1E4E8;">; </span><span style="color:#6A737D;">//字串长度计1</span></span>
<span class="line"><span style="color:#E1E4E8;">		} </span><span style="color:#F97583;">elseif</span><span style="color:#E1E4E8;"> ($ascnum </span><span style="color:#F97583;">&gt;=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">192</span><span style="color:#E1E4E8;">){ </span><span style="color:#6A737D;">//如果ASCII位高与192，</span></span>
<span class="line"><span style="color:#E1E4E8;">		   $returnstr </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $returnstr </span><span style="color:#F97583;">.</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">substr</span><span style="color:#E1E4E8;"> ( $sourcestr, $i, </span><span style="color:#79B8FF;">2</span><span style="color:#E1E4E8;"> ); </span><span style="color:#6A737D;">//根据UTF-8编码规范，将2个连续的字符计为单个字符 </span></span>
<span class="line"><span style="color:#E1E4E8;">		   $i </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $i </span><span style="color:#F97583;">+</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">2</span><span style="color:#E1E4E8;">; </span><span style="color:#6A737D;">//实际Byte计为2</span></span>
<span class="line"><span style="color:#E1E4E8;">		   $n </span><span style="color:#F97583;">++</span><span style="color:#E1E4E8;">; </span><span style="color:#6A737D;">//字串长度计1</span></span>
<span class="line"><span style="color:#E1E4E8;">		} </span><span style="color:#F97583;">elseif</span><span style="color:#E1E4E8;"> ($ascnum </span><span style="color:#F97583;">&gt;=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">65</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">&amp;&amp;</span><span style="color:#E1E4E8;"> $ascnum </span><span style="color:#F97583;">&lt;=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">90</span><span style="color:#E1E4E8;">) {</span><span style="color:#6A737D;">//如果是大写字母，</span></span>
<span class="line"><span style="color:#E1E4E8;">		 $returnstr </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $returnstr </span><span style="color:#F97583;">.</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">substr</span><span style="color:#E1E4E8;"> ( $sourcestr, $i, </span><span style="color:#79B8FF;">1</span><span style="color:#E1E4E8;"> );</span></span>
<span class="line"><span style="color:#E1E4E8;">		 $i </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $i </span><span style="color:#F97583;">+</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">1</span><span style="color:#E1E4E8;">; </span><span style="color:#6A737D;">//实际的Byte数仍计1个</span></span>
<span class="line"><span style="color:#E1E4E8;">		 $n </span><span style="color:#F97583;">++</span><span style="color:#E1E4E8;">; </span><span style="color:#6A737D;">//但考虑整体美观，大写字母计成一个高位字符</span></span>
<span class="line"><span style="color:#E1E4E8;">		}</span><span style="color:#F97583;">elseif</span><span style="color:#E1E4E8;"> ($ascnum </span><span style="color:#F97583;">&gt;=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">97</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">&amp;&amp;</span><span style="color:#E1E4E8;"> $ascnum </span><span style="color:#F97583;">&lt;=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">122</span><span style="color:#E1E4E8;">) {</span></span>
<span class="line"><span style="color:#E1E4E8;">		  $returnstr </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $returnstr </span><span style="color:#F97583;">.</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">substr</span><span style="color:#E1E4E8;"> ( $sourcestr, $i, </span><span style="color:#79B8FF;">1</span><span style="color:#E1E4E8;"> );</span></span>
<span class="line"><span style="color:#E1E4E8;">		  $i </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $i </span><span style="color:#F97583;">+</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">1</span><span style="color:#E1E4E8;">; </span><span style="color:#6A737D;">//实际的Byte数仍计1个</span></span>
<span class="line"><span style="color:#E1E4E8;">		  $n </span><span style="color:#F97583;">++</span><span style="color:#E1E4E8;">; </span><span style="color:#6A737D;">//但考虑整体美观，大写字母计成一个高位字符</span></span>
<span class="line"><span style="color:#E1E4E8;">		} </span><span style="color:#F97583;">else</span><span style="color:#E1E4E8;"> {</span><span style="color:#6A737D;">//其他情况下，半角标点符号，</span></span>
<span class="line"><span style="color:#E1E4E8;">		 $returnstr </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $returnstr </span><span style="color:#F97583;">.</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">substr</span><span style="color:#E1E4E8;"> ( $sourcestr, $i, </span><span style="color:#79B8FF;">1</span><span style="color:#E1E4E8;"> );</span></span>
<span class="line"><span style="color:#E1E4E8;">		 $i </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $i </span><span style="color:#F97583;">+</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">1</span><span style="color:#E1E4E8;">; </span></span>
<span class="line"><span style="color:#E1E4E8;">		 $n </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $n </span><span style="color:#F97583;">+</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">0.5</span><span style="color:#E1E4E8;">; </span></span>
<span class="line"><span style="color:#E1E4E8;">		}</span></span>
<span class="line"><span style="color:#E1E4E8;">	   }</span></span>
<span class="line"><span style="color:#E1E4E8;">	   </span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;">($i</span><span style="color:#F97583;">&lt;</span><span style="color:#E1E4E8;">$str_length){</span></span>
<span class="line"><span style="color:#E1E4E8;">		$returnstr</span><span style="color:#F97583;">.=</span><span style="color:#9ECBFF;">&#39;...&#39;</span><span style="color:#E1E4E8;">;   </span></span>
<span class="line"><span style="color:#E1E4E8;">	   }</span></span>
<span class="line"><span style="color:#E1E4E8;">	   </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> $returnstr;</span></span>
<span class="line"><span style="color:#E1E4E8;">}</span></span>
<span class="line"><span style="color:#6A737D;">//过滤sql数值-公共方法</span></span>
<span class="line"><span style="color:#F97583;">function</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">new_addslashes</span><span style="color:#E1E4E8;">($string){</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;">(</span><span style="color:#F97583;">!</span><span style="color:#79B8FF;">is_array</span><span style="color:#E1E4E8;">($string)) </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">addslashes</span><span style="color:#E1E4E8;">($string);</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">foreach</span><span style="color:#E1E4E8;">($string </span><span style="color:#F97583;">as</span><span style="color:#E1E4E8;"> $key </span><span style="color:#F97583;">=&gt;</span><span style="color:#E1E4E8;"> $val){</span></span>
<span class="line"><span style="color:#E1E4E8;">		$string[$key] </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">addslashes</span><span style="color:#E1E4E8;">($val);</span></span>
<span class="line"><span style="color:#E1E4E8;">	}</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> $string;</span></span>
<span class="line"><span style="color:#E1E4E8;">}</span></span>
<span class="line"><span style="color:#6A737D;">//保留空格与回车</span></span>
<span class="line"><span style="color:#F97583;">function</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">str2html</span><span style="color:#E1E4E8;">($content,$re</span><span style="color:#F97583;">=</span><span style="color:#79B8FF;">false</span><span style="color:#E1E4E8;">){</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;">($re){</span></span>
<span class="line"><span style="color:#E1E4E8;">		$pattern </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">array</span><span style="color:#E1E4E8;">(</span></span>
<span class="line"><span style="color:#E1E4E8;">			</span><span style="color:#9ECBFF;">&#39; &#39;</span><span style="color:#E1E4E8;">,</span><span style="color:#6A737D;">//半角下空格</span></span>
<span class="line"><span style="color:#E1E4E8;">			</span><span style="color:#9ECBFF;">&#39;　&#39;</span><span style="color:#E1E4E8;">,</span><span style="color:#6A737D;">//全角下空格</span></span>
<span class="line"><span style="color:#E1E4E8;">			</span><span style="color:#9ECBFF;">&#39;\r\n&#39;</span><span style="color:#E1E4E8;">,</span><span style="color:#6A737D;">//window 下换行符</span></span>
<span class="line"><span style="color:#E1E4E8;">			</span><span style="color:#9ECBFF;">&#39;\n&#39;</span><span style="color:#6A737D;">//Linux &amp;&amp; Unix 下换行符</span></span>
<span class="line"><span style="color:#E1E4E8;">		);</span></span>
<span class="line"><span style="color:#E1E4E8;">		$replace </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">array</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;/</span><span style="color:#DBEDFF;">&amp;nbsp;</span><span style="color:#9ECBFF;">/&#39;</span><span style="color:#E1E4E8;">,</span><span style="color:#9ECBFF;">&#39;/</span><span style="color:#DBEDFF;">&amp;nbsp;</span><span style="color:#9ECBFF;">/&#39;</span><span style="color:#E1E4E8;">,</span><span style="color:#9ECBFF;">&#39;/</span><span style="color:#DBEDFF;">&lt;br </span><span style="color:#85E89D;font-weight:bold;">\/</span><span style="color:#DBEDFF;">&gt;</span><span style="color:#9ECBFF;">/&#39;</span><span style="color:#E1E4E8;">,</span><span style="color:#9ECBFF;">&#39;/</span><span style="color:#DBEDFF;">&lt;br </span><span style="color:#85E89D;font-weight:bold;">\/</span><span style="color:#DBEDFF;">&gt;</span><span style="color:#9ECBFF;">/&#39;</span><span style="color:#E1E4E8;">); </span></span>
<span class="line"><span style="color:#E1E4E8;">		</span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">preg_replace</span><span style="color:#E1E4E8;">($replace,$pattern, $content);</span></span>
<span class="line"><span style="color:#E1E4E8;">	}</span><span style="color:#F97583;">else</span><span style="color:#E1E4E8;">{</span></span>
<span class="line"><span style="color:#E1E4E8;">		$pattern </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">array</span><span style="color:#E1E4E8;">(</span></span>
<span class="line"><span style="color:#E1E4E8;">			</span><span style="color:#9ECBFF;">&#39;/</span><span style="color:#DBEDFF;"> </span><span style="color:#9ECBFF;">/&#39;</span><span style="color:#E1E4E8;">,</span><span style="color:#6A737D;">//半角下空格</span></span>
<span class="line"><span style="color:#E1E4E8;">			</span><span style="color:#9ECBFF;">&#39;/</span><span style="color:#DBEDFF;">　</span><span style="color:#9ECBFF;">/&#39;</span><span style="color:#E1E4E8;">,</span><span style="color:#6A737D;">//全角下空格</span></span>
<span class="line"><span style="color:#E1E4E8;">			</span><span style="color:#9ECBFF;">&#39;/</span><span style="color:#85E89D;font-weight:bold;">\r\n</span><span style="color:#9ECBFF;">/&#39;</span><span style="color:#E1E4E8;">,</span><span style="color:#6A737D;">//window 下换行符</span></span>
<span class="line"><span style="color:#E1E4E8;">			</span><span style="color:#9ECBFF;">&#39;/</span><span style="color:#85E89D;font-weight:bold;">\n</span><span style="color:#9ECBFF;">/&#39;</span><span style="color:#6A737D;">//Linux &amp;&amp; Unix 下换行符</span></span>
<span class="line"><span style="color:#E1E4E8;">		);</span></span>
<span class="line"><span style="color:#E1E4E8;">		$replace </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">array</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;&amp;nbsp;&#39;</span><span style="color:#E1E4E8;">,</span><span style="color:#9ECBFF;">&#39;&amp;nbsp;&#39;</span><span style="color:#E1E4E8;">,</span><span style="color:#9ECBFF;">&#39;&lt;br /&gt;&#39;</span><span style="color:#E1E4E8;">,</span><span style="color:#9ECBFF;">&#39;&lt;br /&gt;&#39;</span><span style="color:#E1E4E8;">); </span></span>
<span class="line"><span style="color:#E1E4E8;">		</span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">preg_replace</span><span style="color:#E1E4E8;">($pattern, $replace,$content);</span></span>
<span class="line"><span style="color:#E1E4E8;">	}</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E1E4E8;">}</span></span>
<span class="line"><span style="color:#6A737D;">//数组取字段转化字符串</span></span>
<span class="line"><span style="color:#F97583;">function</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">arr2str</span><span style="color:#E1E4E8;">($arr,$word,$tag</span><span style="color:#F97583;">=</span><span style="color:#9ECBFF;">&#39;,&#39;</span><span style="color:#E1E4E8;">){</span></span>
<span class="line"><span style="color:#E1E4E8;">	$str </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&#39;&#39;</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;">(</span><span style="color:#F97583;">!</span><span style="color:#79B8FF;">is_array</span><span style="color:#E1E4E8;">($arr)){</span></span>
<span class="line"><span style="color:#E1E4E8;">		</span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">false</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">	}	</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">foreach</span><span style="color:#E1E4E8;">($arr </span><span style="color:#F97583;">as</span><span style="color:#E1E4E8;"> $kk</span><span style="color:#F97583;">=&gt;</span><span style="color:#E1E4E8;">$vv){</span></span>
<span class="line"><span style="color:#E1E4E8;">		</span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;">(</span><span style="color:#F97583;">!</span><span style="color:#E1E4E8;">$vv[$word]){</span></span>
<span class="line"><span style="color:#E1E4E8;">			</span><span style="color:#F97583;">continue</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">		}</span></span>
<span class="line"><span style="color:#E1E4E8;">		$str</span><span style="color:#F97583;">.=</span><span style="color:#9ECBFF;">&#39;,&#39;</span><span style="color:#F97583;">.</span><span style="color:#E1E4E8;">$vv[$word];</span></span>
<span class="line"><span style="color:#E1E4E8;">	}</span></span>
<span class="line"><span style="color:#E1E4E8;">	$str </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">trim</span><span style="color:#E1E4E8;">($str,</span><span style="color:#9ECBFF;">&#39;,&#39;</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">empty</span><span style="color:#E1E4E8;">($str)){</span></span>
<span class="line"><span style="color:#E1E4E8;">       </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;">  </span><span style="color:#F97583;">-</span><span style="color:#79B8FF;">1</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">    }</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">str_replace</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;,&#39;</span><span style="color:#E1E4E8;">,$tag,$str);</span></span>
<span class="line"><span style="color:#E1E4E8;">}</span></span>
<span class="line"><span style="color:#6A737D;">/**</span></span>
<span class="line"><span style="color:#6A737D;">*获取ip地址</span></span>
<span class="line"><span style="color:#6A737D;">*/</span></span>
<span class="line"><span style="color:#F97583;">function</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">get_real_ip</span><span style="color:#E1E4E8;">()  {  </span></span>
<span class="line"><span style="color:#E1E4E8;">    $ip</span><span style="color:#F97583;">=</span><span style="color:#79B8FF;">false</span><span style="color:#E1E4E8;">;  </span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;">(</span><span style="color:#F97583;">!</span><span style="color:#79B8FF;">empty</span><span style="color:#E1E4E8;">($_SERVER[</span><span style="color:#9ECBFF;">&quot;HTTP_CLIENT_IP&quot;</span><span style="color:#E1E4E8;">])){  </span></span>
<span class="line"><span style="color:#E1E4E8;">      $ip </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $_SERVER[</span><span style="color:#9ECBFF;">&quot;HTTP_CLIENT_IP&quot;</span><span style="color:#E1E4E8;">];  </span></span>
<span class="line"><span style="color:#E1E4E8;">    }  </span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;"> (</span><span style="color:#F97583;">!</span><span style="color:#79B8FF;">empty</span><span style="color:#E1E4E8;">($_SERVER[</span><span style="color:#9ECBFF;">&#39;HTTP_X_FORWARDED_FOR&#39;</span><span style="color:#E1E4E8;">])){  </span></span>
<span class="line"><span style="color:#E1E4E8;">          $ips </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">explode</span><span style="color:#E1E4E8;"> (</span><span style="color:#9ECBFF;">&quot;, &quot;</span><span style="color:#E1E4E8;">, $_SERVER[</span><span style="color:#9ECBFF;">&#39;HTTP_X_FORWARDED_FOR&#39;</span><span style="color:#E1E4E8;">]);  </span></span>
<span class="line"><span style="color:#E1E4E8;">          </span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;">($ip){  </span></span>
<span class="line"><span style="color:#E1E4E8;">           </span><span style="color:#79B8FF;">array_unshift</span><span style="color:#E1E4E8;">($ips, $ip); $ip </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">FALSE</span><span style="color:#E1E4E8;">;  </span></span>
<span class="line"><span style="color:#E1E4E8;">          }  </span></span>
<span class="line"><span style="color:#E1E4E8;">          </span><span style="color:#F97583;">for</span><span style="color:#E1E4E8;">($i </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">0</span><span style="color:#E1E4E8;">; $i </span><span style="color:#F97583;">&lt;</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">count</span><span style="color:#E1E4E8;">($ips); $i</span><span style="color:#F97583;">++</span><span style="color:#E1E4E8;">){  </span></span>
<span class="line"><span style="color:#E1E4E8;">               </span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;"> (</span><span style="color:#F97583;">!</span><span style="color:#79B8FF;">eregi</span><span style="color:#E1E4E8;"> (</span><span style="color:#9ECBFF;">&quot;^(10|172.16|192.168).&quot;</span><span style="color:#E1E4E8;">, $ips[$i])){  </span></span>
<span class="line"><span style="color:#E1E4E8;">                    $ip </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $ips[$i];  </span></span>
<span class="line"><span style="color:#E1E4E8;">                    </span><span style="color:#F97583;">break</span><span style="color:#E1E4E8;">;  </span></span>
<span class="line"><span style="color:#E1E4E8;">               }  </span></span>
<span class="line"><span style="color:#E1E4E8;">          }  </span></span>
<span class="line"><span style="color:#E1E4E8;">    }  </span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;">($ip</span><span style="color:#F97583;">?</span><span style="color:#E1E4E8;">$ip</span><span style="color:#F97583;">:</span><span style="color:#E1E4E8;">$_SERVER[</span><span style="color:#9ECBFF;">&#39;REMOTE_ADDR&#39;</span><span style="color:#E1E4E8;">]);  </span></span>
<span class="line"><span style="color:#E1E4E8;">}</span></span>
<span class="line"><span style="color:#6A737D;">/*</span></span>
<span class="line"><span style="color:#6A737D;"> 查询联表信息 取关联数据</span></span>
<span class="line"><span style="color:#6A737D;">@parm $table 查询的数据表</span></span>
<span class="line"><span style="color:#6A737D;">@parm $ids_arr 查询条件数组</span></span>
<span class="line"><span style="color:#6A737D;">@parm $field_arr  获取字段数组</span></span>
<span class="line"><span style="color:#6A737D;">@parm $table_join  外键对应字段</span></span>
<span class="line"><span style="color:#6A737D;">*/</span></span>
<span class="line"><span style="color:#F97583;">function</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">getInfoByIds</span><span style="color:#E1E4E8;">($table,$ids_arr,$field_arr,$table_join){</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">empty</span><span style="color:#E1E4E8;">($ids_arr) </span><span style="color:#F97583;">||</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">empty</span><span style="color:#E1E4E8;">($field_arr) </span><span style="color:#F97583;">||</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">!</span><span style="color:#79B8FF;">is_array</span><span style="color:#E1E4E8;">($ids_arr) </span><span style="color:#F97583;">||</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">!</span><span style="color:#79B8FF;">is_array</span><span style="color:#E1E4E8;">($field_arr)){</span></span>
<span class="line"><span style="color:#E1E4E8;">		</span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">array</span><span style="color:#E1E4E8;">();</span></span>
<span class="line"><span style="color:#E1E4E8;">	}</span></span>
<span class="line"><span style="color:#E1E4E8;">	$user_ids </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">implode</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;,&#39;</span><span style="color:#E1E4E8;">,$ids_arr);</span></span>
<span class="line"><span style="color:#E1E4E8;">	$fields </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">implode</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;,&#39;</span><span style="color:#E1E4E8;">,$field_arr);  </span></span>
<span class="line"><span style="color:#E1E4E8;">	$sql </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&quot;select &quot;</span><span style="color:#F97583;">.</span><span style="color:#E1E4E8;">$table_join</span><span style="color:#F97583;">.</span><span style="color:#9ECBFF;">&quot;,&quot;</span><span style="color:#F97583;">.</span><span style="color:#E1E4E8;">$fields</span><span style="color:#F97583;">.</span><span style="color:#9ECBFF;">&quot; from &quot;</span><span style="color:#F97583;">.</span><span style="color:#E1E4E8;">$table</span><span style="color:#F97583;">.</span><span style="color:#9ECBFF;">&quot; where &quot;</span><span style="color:#F97583;">.</span><span style="color:#E1E4E8;">$table_join</span><span style="color:#F97583;">.</span><span style="color:#9ECBFF;">&quot; in(&quot;</span><span style="color:#F97583;">.</span><span style="color:#E1E4E8;">$user_ids</span><span style="color:#F97583;">.</span><span style="color:#9ECBFF;">&quot;)&quot;</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">	$member_info </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">$this</span><span style="color:#F97583;">-&gt;</span><span style="color:#B392F0;">db</span><span style="color:#E1E4E8;">()</span><span style="color:#F97583;">-&gt;</span><span style="color:#B392F0;">getAll</span><span style="color:#E1E4E8;">($sql);</span></span>
<span class="line"><span style="color:#E1E4E8;">	$return_arr </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">array</span><span style="color:#E1E4E8;">();</span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">foreach</span><span style="color:#E1E4E8;">($member_info </span><span style="color:#F97583;">as</span><span style="color:#E1E4E8;"> $kk</span><span style="color:#F97583;">=&gt;</span><span style="color:#E1E4E8;">$vv){</span></span>
<span class="line"><span style="color:#E1E4E8;">		$return_arr[$vv[$table_join]]</span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;">$vv;</span></span>
<span class="line"><span style="color:#E1E4E8;">	}  </span></span>
<span class="line"><span style="color:#E1E4E8;">	</span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> $return_arr;</span></span>
<span class="line"><span style="color:#E1E4E8;">}</span></span>
<span class="line"><span style="color:#6A737D;">/*</span></span>
<span class="line"><span style="color:#6A737D;">* 加密解密字符</span></span>
<span class="line"><span style="color:#6A737D;">* parm $operation  DECODE解密 ENCODE加密</span></span>
<span class="line"><span style="color:#6A737D;">*  parm $string 要加密解密的字符</span></span>
<span class="line"><span style="color:#6A737D;">* parm $key 验证关键字</span></span>
<span class="line"><span style="color:#6A737D;">*/</span></span>
<span class="line"></span>
<span class="line"><span style="color:#F97583;">function</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">encryptDecrypt</span><span style="color:#E1E4E8;">($string, $operation </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&#39;DECODE&#39;</span><span style="color:#E1E4E8;">, $key </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&#39;&#39;</span><span style="color:#E1E4E8;">, $expiry </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">0</span><span style="color:#E1E4E8;">) {</span></span>
<span class="line"><span style="color:#E1E4E8;">		</span></span>
<span class="line"><span style="color:#E1E4E8;">	  $auth_key </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&#39;%&amp;black_technology_YYYY!Q@W#$6y8i*&amp;%&#39;</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">      $ckey_length </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">4</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E1E4E8;">      $key </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">md5</span><span style="color:#E1E4E8;">($key </span><span style="color:#F97583;">?</span><span style="color:#E1E4E8;"> $key </span><span style="color:#F97583;">:</span><span style="color:#E1E4E8;"> $auth_key);</span></span>
<span class="line"><span style="color:#E1E4E8;">      $keya </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">md5</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">substr</span><span style="color:#E1E4E8;">($key, </span><span style="color:#79B8FF;">0</span><span style="color:#E1E4E8;">, </span><span style="color:#79B8FF;">16</span><span style="color:#E1E4E8;">));</span></span>
<span class="line"><span style="color:#E1E4E8;">      $keyb </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">md5</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">substr</span><span style="color:#E1E4E8;">($key, </span><span style="color:#79B8FF;">16</span><span style="color:#E1E4E8;">, </span><span style="color:#79B8FF;">16</span><span style="color:#E1E4E8;">));</span></span>
<span class="line"><span style="color:#E1E4E8;">      $keyc </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $ckey_length </span><span style="color:#F97583;">?</span><span style="color:#E1E4E8;"> ($operation </span><span style="color:#F97583;">==</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&#39;DECODE&#39;</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">?</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">substr</span><span style="color:#E1E4E8;">($string, </span><span style="color:#79B8FF;">0</span><span style="color:#E1E4E8;">, $ckey_length) </span><span style="color:#F97583;">:</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">substr</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">md5</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">microtime</span><span style="color:#E1E4E8;">()), </span><span style="color:#F97583;">-</span><span style="color:#E1E4E8;">$ckey_length)) </span><span style="color:#F97583;">:</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&#39;&#39;</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E1E4E8;">      $cryptkey </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $keya </span><span style="color:#F97583;">.</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">md5</span><span style="color:#E1E4E8;">($keya </span><span style="color:#F97583;">.</span><span style="color:#E1E4E8;"> $keyc);</span></span>
<span class="line"><span style="color:#E1E4E8;">      $key_length </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">strlen</span><span style="color:#E1E4E8;">($cryptkey);</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E1E4E8;">      $string </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $operation </span><span style="color:#F97583;">==</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&#39;DECODE&#39;</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">?</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">base64_decode</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">strtr</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">substr</span><span style="color:#E1E4E8;">($string, $ckey_length), </span><span style="color:#9ECBFF;">&#39;-_&#39;</span><span style="color:#E1E4E8;">, </span><span style="color:#9ECBFF;">&#39;+/&#39;</span><span style="color:#E1E4E8;">))</span><span style="color:#F97583;">:</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">sprintf</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;%010d&#39;</span><span style="color:#E1E4E8;">, $expiry </span><span style="color:#F97583;">?</span><span style="color:#E1E4E8;"> $expiry </span><span style="color:#F97583;">+</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">time</span><span style="color:#E1E4E8;">() </span><span style="color:#F97583;">:</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">0</span><span style="color:#E1E4E8;">) </span><span style="color:#F97583;">.</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">substr</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">md5</span><span style="color:#E1E4E8;">($string </span><span style="color:#F97583;">.</span><span style="color:#E1E4E8;"> $keyb), </span><span style="color:#79B8FF;">0</span><span style="color:#E1E4E8;">, </span><span style="color:#79B8FF;">16</span><span style="color:#E1E4E8;">) </span><span style="color:#F97583;">.</span><span style="color:#E1E4E8;"> $string;</span></span>
<span class="line"><span style="color:#E1E4E8;">      $string_length </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">strlen</span><span style="color:#E1E4E8;">($string);</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E1E4E8;">      $result </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&#39;&#39;</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">      $box </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">range</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">0</span><span style="color:#E1E4E8;">, </span><span style="color:#79B8FF;">255</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E1E4E8;">      $rndkey </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">array</span><span style="color:#E1E4E8;">();</span></span>
<span class="line"><span style="color:#E1E4E8;">      </span><span style="color:#F97583;">for</span><span style="color:#E1E4E8;"> ($i </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">0</span><span style="color:#E1E4E8;">; $i </span><span style="color:#F97583;">&lt;=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">255</span><span style="color:#E1E4E8;">; $i</span><span style="color:#F97583;">++</span><span style="color:#E1E4E8;">) {</span></span>
<span class="line"><span style="color:#E1E4E8;">          $rndkey[$i] </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">ord</span><span style="color:#E1E4E8;">($cryptkey[$i </span><span style="color:#F97583;">%</span><span style="color:#E1E4E8;"> $key_length]);</span></span>
<span class="line"><span style="color:#E1E4E8;">      }</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E1E4E8;">      </span><span style="color:#F97583;">for</span><span style="color:#E1E4E8;"> ($j </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $i </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">0</span><span style="color:#E1E4E8;">; $i </span><span style="color:#F97583;">&lt;</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">256</span><span style="color:#E1E4E8;">; $i</span><span style="color:#F97583;">++</span><span style="color:#E1E4E8;">) {</span></span>
<span class="line"><span style="color:#E1E4E8;">          $j </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> ($j </span><span style="color:#F97583;">+</span><span style="color:#E1E4E8;"> $box[$i] </span><span style="color:#F97583;">+</span><span style="color:#E1E4E8;"> $rndkey[$i]) </span><span style="color:#F97583;">%</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">256</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">          $tmp </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $box[$i];</span></span>
<span class="line"><span style="color:#E1E4E8;">          $box[$i] </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $box[$j];</span></span>
<span class="line"><span style="color:#E1E4E8;">          $box[$j] </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $tmp;</span></span>
<span class="line"><span style="color:#E1E4E8;">      }</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E1E4E8;">      </span><span style="color:#F97583;">for</span><span style="color:#E1E4E8;"> ($a </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $j </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $i </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">0</span><span style="color:#E1E4E8;">; $i </span><span style="color:#F97583;">&lt;</span><span style="color:#E1E4E8;"> $string_length; $i</span><span style="color:#F97583;">++</span><span style="color:#E1E4E8;">) {</span></span>
<span class="line"><span style="color:#E1E4E8;">          $a </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> ($a </span><span style="color:#F97583;">+</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">1</span><span style="color:#E1E4E8;">) </span><span style="color:#F97583;">%</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">256</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">          $j </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> ($j </span><span style="color:#F97583;">+</span><span style="color:#E1E4E8;"> $box[$a]) </span><span style="color:#F97583;">%</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">256</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">          $tmp </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $box[$a];</span></span>
<span class="line"><span style="color:#E1E4E8;">          $box[$a] </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $box[$j];</span></span>
<span class="line"><span style="color:#E1E4E8;">          $box[$j] </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> $tmp;</span></span>
<span class="line"><span style="color:#E1E4E8;">          $result </span><span style="color:#F97583;">.=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">chr</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">ord</span><span style="color:#E1E4E8;">($string[$i]) </span><span style="color:#F97583;">^</span><span style="color:#E1E4E8;"> ($box[($box[$a] </span><span style="color:#F97583;">+</span><span style="color:#E1E4E8;"> $box[$j]) </span><span style="color:#F97583;">%</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">256</span><span style="color:#E1E4E8;">]));</span></span>
<span class="line"><span style="color:#E1E4E8;">      }</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E1E4E8;">      </span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;"> ($operation </span><span style="color:#F97583;">==</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&#39;DECODE&#39;</span><span style="color:#E1E4E8;">) {</span></span>
<span class="line"><span style="color:#E1E4E8;">          </span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;"> ((</span><span style="color:#79B8FF;">substr</span><span style="color:#E1E4E8;">($result, </span><span style="color:#79B8FF;">0</span><span style="color:#E1E4E8;">, </span><span style="color:#79B8FF;">10</span><span style="color:#E1E4E8;">) </span><span style="color:#F97583;">==</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">0</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">||</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">substr</span><span style="color:#E1E4E8;">($result, </span><span style="color:#79B8FF;">0</span><span style="color:#E1E4E8;">, </span><span style="color:#79B8FF;">10</span><span style="color:#E1E4E8;">) </span><span style="color:#F97583;">-</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">time</span><span style="color:#E1E4E8;">() </span><span style="color:#F97583;">&gt;</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">0</span><span style="color:#E1E4E8;">) </span><span style="color:#F97583;">&amp;&amp;</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">substr</span><span style="color:#E1E4E8;">($result, </span><span style="color:#79B8FF;">10</span><span style="color:#E1E4E8;">, </span><span style="color:#79B8FF;">16</span><span style="color:#E1E4E8;">) </span><span style="color:#F97583;">==</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">substr</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">md5</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">substr</span><span style="color:#E1E4E8;">($result, </span><span style="color:#79B8FF;">26</span><span style="color:#E1E4E8;">) </span><span style="color:#F97583;">.</span><span style="color:#E1E4E8;"> $keyb), </span><span style="color:#79B8FF;">0</span><span style="color:#E1E4E8;">, </span><span style="color:#79B8FF;">16</span><span style="color:#E1E4E8;">)) {</span></span>
<span class="line"><span style="color:#E1E4E8;">              </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">substr</span><span style="color:#E1E4E8;">($result, </span><span style="color:#79B8FF;">26</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">          } </span><span style="color:#F97583;">else</span><span style="color:#E1E4E8;"> {</span></span>
<span class="line"><span style="color:#E1E4E8;">              </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&#39;&#39;</span><span style="color:#E1E4E8;">;</span></span>
<span class="line"><span style="color:#E1E4E8;">          }</span></span>
<span class="line"><span style="color:#E1E4E8;">      } </span><span style="color:#F97583;">else</span><span style="color:#E1E4E8;"> {</span></span>
<span class="line"><span style="color:#E1E4E8;">          </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> $keyc </span><span style="color:#F97583;">.</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">str_replace</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;=&#39;</span><span style="color:#E1E4E8;">, </span><span style="color:#9ECBFF;">&#39;&#39;</span><span style="color:#E1E4E8;">, </span><span style="color:#79B8FF;">rtrim</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">strtr</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">base64_encode</span><span style="color:#E1E4E8;">($result), </span><span style="color:#9ECBFF;">&#39;+/&#39;</span><span style="color:#E1E4E8;">, </span><span style="color:#9ECBFF;">&#39;-_&#39;</span><span style="color:#E1E4E8;">), </span><span style="color:#9ECBFF;">&#39;=&#39;</span><span style="color:#E1E4E8;">));</span></span>
<span class="line"><span style="color:#E1E4E8;">      }</span></span>
<span class="line"><span style="color:#E1E4E8;">    }</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#6A737D;">//去除数组或对象中的null值，改为空字符（用于接口返回数据）</span></span>
<span class="line"><span style="color:#24292E;"> </span><span style="color:#D73A49;">private</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">function</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">check_null</span><span style="color:#24292E;">($object){</span></span>
<span class="line"><span style="color:#24292E;">		$object </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">json_encode</span><span style="color:#24292E;">($object);</span></span>
<span class="line"><span style="color:#24292E;">		$object </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">str_replace</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;null&#39;</span><span style="color:#24292E;">,</span><span style="color:#032F62;">&#39;&quot;&quot;&#39;</span><span style="color:#24292E;">,$object);</span></span>
<span class="line"><span style="color:#24292E;">		$object </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">json_decode</span><span style="color:#24292E;">($object);</span></span>
<span class="line"><span style="color:#24292E;">		</span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> $object;</span></span>
<span class="line"><span style="color:#24292E;">	}</span></span>
<span class="line"><span style="color:#24292E;">	</span></span>
<span class="line"><span style="color:#6A737D;">/*</span></span>
<span class="line"><span style="color:#6A737D;">//把时间转换为几小时前/几秒前样式</span></span>
<span class="line"><span style="color:#6A737D;">*/</span></span>
<span class="line"><span style="color:#6A737D;">//处理时间</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">private</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">function</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">time_tranx</span><span style="color:#24292E;">($the_time){  </span></span>
<span class="line"><span style="color:#24292E;">	   $now_time </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">date</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot;Y-m-d H:i:s&quot;</span><span style="color:#24292E;">,</span><span style="color:#005CC5;">time</span><span style="color:#24292E;">()</span><span style="color:#D73A49;">+</span><span style="color:#005CC5;">8</span><span style="color:#D73A49;">*</span><span style="color:#005CC5;">60</span><span style="color:#D73A49;">*</span><span style="color:#005CC5;">60</span><span style="color:#24292E;">);  </span></span>
<span class="line"><span style="color:#24292E;">	   $now_time </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">strtotime</span><span style="color:#24292E;">($now_time);  </span></span>
<span class="line"><span style="color:#24292E;">	   $show_time </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">strtotime</span><span style="color:#24292E;">($the_time);  </span></span>
<span class="line"><span style="color:#24292E;">	   $dur </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $now_time </span><span style="color:#D73A49;">-</span><span style="color:#24292E;"> $show_time;</span></span>
<span class="line"><span style="color:#24292E;">		</span><span style="color:#D73A49;">if</span><span style="color:#24292E;"> ($dur </span><span style="color:#D73A49;">&lt;</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">60</span><span style="color:#24292E;">) {  </span></span>
<span class="line"><span style="color:#24292E;">            </span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> $dur </span><span style="color:#D73A49;">.</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&#39;秒前&#39;</span><span style="color:#24292E;">;  </span></span>
<span class="line"><span style="color:#24292E;">        }</span><span style="color:#D73A49;">elseif</span><span style="color:#24292E;"> ($dur </span><span style="color:#D73A49;">&lt;</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">3600</span><span style="color:#24292E;">) {   </span></span>
<span class="line"><span style="color:#24292E;">            </span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">floor</span><span style="color:#24292E;">($dur</span><span style="color:#D73A49;">/</span><span style="color:#005CC5;">60</span><span style="color:#24292E;">) </span><span style="color:#D73A49;">.</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&#39;分钟前&#39;</span><span style="color:#24292E;">;  </span></span>
<span class="line"><span style="color:#24292E;">        }</span><span style="color:#D73A49;">elseif</span><span style="color:#24292E;">($dur </span><span style="color:#D73A49;">&lt;</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">86400</span><span style="color:#24292E;">){  </span></span>
<span class="line"><span style="color:#24292E;">			</span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">floor</span><span style="color:#24292E;">($dur</span><span style="color:#D73A49;">/</span><span style="color:#005CC5;">3600</span><span style="color:#24292E;">)</span><span style="color:#D73A49;">.</span><span style="color:#032F62;">&#39;小时前&#39;</span><span style="color:#24292E;">;  </span></span>
<span class="line"><span style="color:#24292E;">		}</span><span style="color:#D73A49;">elseif</span><span style="color:#24292E;">($dur </span><span style="color:#D73A49;">&lt;</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">259200</span><span style="color:#24292E;">){ </span><span style="color:#6A737D;">//3天内  </span></span>
<span class="line"><span style="color:#24292E;">			</span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">floor</span><span style="color:#24292E;">($dur</span><span style="color:#D73A49;">/</span><span style="color:#005CC5;">86400</span><span style="color:#24292E;">)</span><span style="color:#D73A49;">.</span><span style="color:#032F62;">&#39;天前&#39;</span><span style="color:#24292E;">;  </span></span>
<span class="line"><span style="color:#24292E;">		}</span><span style="color:#D73A49;">elseif</span><span style="color:#24292E;">($dur </span><span style="color:#D73A49;">&lt;</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">604800</span><span style="color:#24292E;">){  </span></span>
<span class="line"><span style="color:#24292E;">			</span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&#39;3天前&#39;</span><span style="color:#24292E;">;  </span></span>
<span class="line"><span style="color:#24292E;">		}</span><span style="color:#D73A49;">else</span><span style="color:#24292E;">{  </span></span>
<span class="line"><span style="color:#24292E;">			</span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">substr</span><span style="color:#24292E;">($the_time,</span><span style="color:#005CC5;">0</span><span style="color:#24292E;">,</span><span style="color:#005CC5;">10</span><span style="color:#24292E;">);  </span></span>
<span class="line"><span style="color:#24292E;">		}   </span></span>
<span class="line"><span style="color:#24292E;">	}  </span></span>
<span class="line"><span style="color:#24292E;"> </span><span style="color:#6A737D;">/**</span></span>
<span class="line"><span style="color:#6A737D;"> * 将秒时间转换成天 小时 分 秒</span></span>
<span class="line"><span style="color:#6A737D;"> * </span><span style="color:#D73A49;">@author</span><span style="color:#6A737D;"> mmy</span></span>
<span class="line"><span style="color:#6A737D;"> * </span><span style="color:#D73A49;">@param</span><span style="color:#6A737D;"> $second</span></span>
<span class="line"><span style="color:#6A737D;"> * </span><span style="color:#D73A49;">@return</span><span style="color:#6A737D;"> </span><span style="color:#D73A49;">string</span></span>
<span class="line"><span style="color:#6A737D;"> */</span></span>
<span class="line"><span style="color:#D73A49;">function</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">time2string</span><span style="color:#24292E;">($second){</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">if</span><span style="color:#24292E;">($second</span><span style="color:#D73A49;">&lt;=</span><span style="color:#005CC5;">0</span><span style="color:#24292E;">){</span></span>
<span class="line"><span style="color:#24292E;">		</span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&#39;0秒&#39;</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">	} </span></span>
<span class="line"><span style="color:#24292E;">	$day </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">floor</span><span style="color:#24292E;">($second</span><span style="color:#D73A49;">/</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">3600</span><span style="color:#D73A49;">*</span><span style="color:#005CC5;">24</span><span style="color:#24292E;">));</span></span>
<span class="line"><span style="color:#24292E;">	$second </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $second</span><span style="color:#D73A49;">%</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">3600</span><span style="color:#D73A49;">*</span><span style="color:#005CC5;">24</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">	$hour </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">floor</span><span style="color:#24292E;">($second</span><span style="color:#D73A49;">/</span><span style="color:#005CC5;">3600</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">	$second </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $second</span><span style="color:#D73A49;">%</span><span style="color:#005CC5;">3600</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">	$minute </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">floor</span><span style="color:#24292E;">($second</span><span style="color:#D73A49;">/</span><span style="color:#005CC5;">60</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">	$second </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $second</span><span style="color:#D73A49;">%</span><span style="color:#005CC5;">60</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">	$str</span><span style="color:#D73A49;">=</span><span style="color:#032F62;">&#39;&#39;</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">if</span><span style="color:#24292E;">(</span><span style="color:#D73A49;">!</span><span style="color:#005CC5;">empty</span><span style="color:#24292E;">($day)){</span></span>
<span class="line"><span style="color:#24292E;">		$str</span><span style="color:#D73A49;">.=</span><span style="color:#24292E;">$day</span><span style="color:#D73A49;">.</span><span style="color:#032F62;">&quot;天&quot;</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">	}</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">if</span><span style="color:#24292E;">(</span><span style="color:#D73A49;">!</span><span style="color:#005CC5;">empty</span><span style="color:#24292E;">($hour)){</span></span>
<span class="line"><span style="color:#24292E;">		$str</span><span style="color:#D73A49;">.=</span><span style="color:#24292E;">$hour</span><span style="color:#D73A49;">.</span><span style="color:#032F62;">&quot;时&quot;</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">	}</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">if</span><span style="color:#24292E;">(</span><span style="color:#D73A49;">!</span><span style="color:#005CC5;">empty</span><span style="color:#24292E;">($minute)){</span></span>
<span class="line"><span style="color:#24292E;">		$str</span><span style="color:#D73A49;">.=</span><span style="color:#24292E;">$minute</span><span style="color:#D73A49;">.</span><span style="color:#032F62;">&quot;分&quot;</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">	}</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">if</span><span style="color:#24292E;">(</span><span style="color:#D73A49;">!</span><span style="color:#005CC5;">empty</span><span style="color:#24292E;">($second)){</span></span>
<span class="line"><span style="color:#24292E;">		$str</span><span style="color:#D73A49;">.=</span><span style="color:#24292E;">$second</span><span style="color:#D73A49;">.</span><span style="color:#032F62;">&quot;秒&quot;</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">	}</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> $str;</span></span>
<span class="line"><span style="color:#24292E;">}</span></span>
<span class="line"><span style="color:#6A737D;">//转义特殊字符</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">function</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">format_html</span><span style="color:#24292E;">($str){</span></span>
<span class="line"><span style="color:#24292E;">		$str </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">strip_tags</span><span style="color:#24292E;">($str);</span></span>
<span class="line"><span style="color:#24292E;">		$str </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">str_replace</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">array</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot;</span><span style="color:#005CC5;">\r\n</span><span style="color:#032F62;">&quot;</span><span style="color:#24292E;">, </span><span style="color:#032F62;">&quot;</span><span style="color:#005CC5;">\r</span><span style="color:#032F62;">&quot;</span><span style="color:#24292E;">, </span><span style="color:#032F62;">&quot;</span><span style="color:#005CC5;">\n</span><span style="color:#032F62;">&quot;</span><span style="color:#24292E;">,</span><span style="color:#032F62;">&quot;</span><span style="color:#005CC5;">\t</span><span style="color:#032F62;">&quot;</span><span style="color:#24292E;">), </span><span style="color:#032F62;">&quot;&quot;</span><span style="color:#24292E;">, $str); </span></span>
<span class="line"><span style="color:#24292E;">		$str </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">str_replace</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;&amp;ldquo;&#39;</span><span style="color:#24292E;">, </span><span style="color:#032F62;">&#39;“&#39;</span><span style="color:#24292E;">,$str);</span></span>
<span class="line"><span style="color:#24292E;">		$str </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">str_replace</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;&amp;rdquo;&#39;</span><span style="color:#24292E;">, </span><span style="color:#032F62;">&#39;”&#39;</span><span style="color:#24292E;">,$str);</span></span>
<span class="line"><span style="color:#24292E;">		$str </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">str_replace</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;&amp;middot;&#39;</span><span style="color:#24292E;">, </span><span style="color:#032F62;">&#39;·&#39;</span><span style="color:#24292E;">,$str);</span></span>
<span class="line"><span style="color:#24292E;">		$str </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">str_replace</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;&amp;lsquo;&#39;</span><span style="color:#24292E;">, </span><span style="color:#032F62;">&#39;‘&#39;</span><span style="color:#24292E;">,$str);</span></span>
<span class="line"><span style="color:#24292E;">		$str </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">str_replace</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;&amp;rsquo;&#39;</span><span style="color:#24292E;">, </span><span style="color:#032F62;">&#39;’&#39;</span><span style="color:#24292E;">,$str);</span></span>
<span class="line"><span style="color:#24292E;">		$str </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">str_replace</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;&amp;hellip;&#39;</span><span style="color:#24292E;">, </span><span style="color:#032F62;">&#39;…&#39;</span><span style="color:#24292E;">, $str);</span></span>
<span class="line"><span style="color:#24292E;">		$str </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">str_replace</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;&amp;mdash;&#39;</span><span style="color:#24292E;">, </span><span style="color:#032F62;">&#39;—&#39;</span><span style="color:#24292E;">, $str);</span></span>
<span class="line"><span style="color:#24292E;">		</span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> $str;</span></span>
<span class="line"><span style="color:#24292E;">	}</span></span>
<span class="line"><span style="color:#6A737D;">//计算字符</span></span>
<span class="line"><span style="color:#D73A49;">function</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">word_count</span><span style="color:#24292E;">($con){</span></span>
<span class="line"><span style="color:#24292E;">		</span></span>
<span class="line"><span style="color:#24292E;">	$con </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">str_replace</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot;,&quot;</span><span style="color:#24292E;">,</span><span style="color:#032F62;">&quot; &quot;</span><span style="color:#24292E;">,$con);</span></span>
<span class="line"><span style="color:#24292E;">	$con </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">str_replace</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot;.&quot;</span><span style="color:#24292E;">,</span><span style="color:#032F62;">&quot; &quot;</span><span style="color:#24292E;">,$con); </span></span>
<span class="line"><span style="color:#24292E;">	$con </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">preg_replace</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot;/\s</span><span style="color:#D73A49;">+</span><span style="color:#032F62;">/&quot;</span><span style="color:#24292E;">,</span><span style="color:#032F62;">&quot; &quot;</span><span style="color:#24292E;">,$con);</span></span>
<span class="line"><span style="color:#24292E;">	$array </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">explode</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot; &quot;</span><span style="color:#24292E;">, $con);  </span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">count</span><span style="color:#24292E;">($array);</span></span>
<span class="line"></span>
<span class="line"><span style="color:#24292E;">}</span></span>
<span class="line"><span style="color:#24292E;">	</span></span>
<span class="line"><span style="color:#6A737D;">/*</span></span>
<span class="line"><span style="color:#6A737D;">Utf-8、gb2312都支持的汉字截取函数</span></span>
<span class="line"><span style="color:#6A737D;">cut_str(字符串, 截取长度, 开始长度, 编码);</span></span>
<span class="line"><span style="color:#6A737D;">编码默认为 utf-8</span></span>
<span class="line"><span style="color:#6A737D;">开始长度默认为 0</span></span>
<span class="line"><span style="color:#6A737D;">*/</span></span>
<span class="line"></span>
<span class="line"><span style="color:#D73A49;">function</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">cut_str</span><span style="color:#24292E;">($sourcestr, $cutlength)</span></span>
<span class="line"><span style="color:#24292E;">{</span></span>
<span class="line"><span style="color:#24292E;">   $sourcestr</span><span style="color:#D73A49;">=</span><span style="color:#005CC5;">strip_tags</span><span style="color:#24292E;">($sourcestr);</span></span>
<span class="line"><span style="color:#24292E;">	$returnstr </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&#39;&#39;</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">	   $i </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">0</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">	   $n </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">0</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">	   $str_length </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">strlen</span><span style="color:#24292E;"> ( $sourcestr ); </span><span style="color:#6A737D;">//字符串的字节数 </span></span>
<span class="line"><span style="color:#24292E;">	   </span><span style="color:#D73A49;">while</span><span style="color:#24292E;"> ( ($n </span><span style="color:#D73A49;">&lt;</span><span style="color:#24292E;"> $cutlength) </span><span style="color:#D73A49;">and</span><span style="color:#24292E;"> ($i </span><span style="color:#D73A49;">&lt;=</span><span style="color:#24292E;"> $str_length) ) {</span></span>
<span class="line"><span style="color:#24292E;">		$temp_str </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">substr</span><span style="color:#24292E;"> ( $sourcestr, $i, </span><span style="color:#005CC5;">1</span><span style="color:#24292E;"> );</span></span>
<span class="line"><span style="color:#24292E;">		$ascnum </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">Ord</span><span style="color:#24292E;"> ( $temp_str ); </span><span style="color:#6A737D;">//得到字符串中第$i位字符的ascii码 </span></span>
<span class="line"><span style="color:#24292E;">		</span><span style="color:#D73A49;">if</span><span style="color:#24292E;"> ($ascnum </span><span style="color:#D73A49;">&gt;=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">224</span><span style="color:#24292E;">) {</span><span style="color:#6A737D;">//如果ASCII位高与224，</span></span>
<span class="line"><span style="color:#24292E;">		   $returnstr </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $returnstr </span><span style="color:#D73A49;">.</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">substr</span><span style="color:#24292E;"> ( $sourcestr, $i, </span><span style="color:#005CC5;">3</span><span style="color:#24292E;"> ); </span><span style="color:#6A737D;">//根据UTF-8编码规范，将3个连续的字符计为单个字符  </span></span>
<span class="line"><span style="color:#24292E;">		   $i </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $i </span><span style="color:#D73A49;">+</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">3</span><span style="color:#24292E;">; </span><span style="color:#6A737D;">//实际Byte计为3</span></span>
<span class="line"><span style="color:#24292E;">		   $n </span><span style="color:#D73A49;">++</span><span style="color:#24292E;">; </span><span style="color:#6A737D;">//字串长度计1</span></span>
<span class="line"><span style="color:#24292E;">		} </span><span style="color:#D73A49;">elseif</span><span style="color:#24292E;"> ($ascnum </span><span style="color:#D73A49;">&gt;=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">192</span><span style="color:#24292E;">){ </span><span style="color:#6A737D;">//如果ASCII位高与192，</span></span>
<span class="line"><span style="color:#24292E;">		   $returnstr </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $returnstr </span><span style="color:#D73A49;">.</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">substr</span><span style="color:#24292E;"> ( $sourcestr, $i, </span><span style="color:#005CC5;">2</span><span style="color:#24292E;"> ); </span><span style="color:#6A737D;">//根据UTF-8编码规范，将2个连续的字符计为单个字符 </span></span>
<span class="line"><span style="color:#24292E;">		   $i </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $i </span><span style="color:#D73A49;">+</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">2</span><span style="color:#24292E;">; </span><span style="color:#6A737D;">//实际Byte计为2</span></span>
<span class="line"><span style="color:#24292E;">		   $n </span><span style="color:#D73A49;">++</span><span style="color:#24292E;">; </span><span style="color:#6A737D;">//字串长度计1</span></span>
<span class="line"><span style="color:#24292E;">		} </span><span style="color:#D73A49;">elseif</span><span style="color:#24292E;"> ($ascnum </span><span style="color:#D73A49;">&gt;=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">65</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">&amp;&amp;</span><span style="color:#24292E;"> $ascnum </span><span style="color:#D73A49;">&lt;=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">90</span><span style="color:#24292E;">) {</span><span style="color:#6A737D;">//如果是大写字母，</span></span>
<span class="line"><span style="color:#24292E;">		 $returnstr </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $returnstr </span><span style="color:#D73A49;">.</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">substr</span><span style="color:#24292E;"> ( $sourcestr, $i, </span><span style="color:#005CC5;">1</span><span style="color:#24292E;"> );</span></span>
<span class="line"><span style="color:#24292E;">		 $i </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $i </span><span style="color:#D73A49;">+</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">1</span><span style="color:#24292E;">; </span><span style="color:#6A737D;">//实际的Byte数仍计1个</span></span>
<span class="line"><span style="color:#24292E;">		 $n </span><span style="color:#D73A49;">++</span><span style="color:#24292E;">; </span><span style="color:#6A737D;">//但考虑整体美观，大写字母计成一个高位字符</span></span>
<span class="line"><span style="color:#24292E;">		}</span><span style="color:#D73A49;">elseif</span><span style="color:#24292E;"> ($ascnum </span><span style="color:#D73A49;">&gt;=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">97</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">&amp;&amp;</span><span style="color:#24292E;"> $ascnum </span><span style="color:#D73A49;">&lt;=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">122</span><span style="color:#24292E;">) {</span></span>
<span class="line"><span style="color:#24292E;">		  $returnstr </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $returnstr </span><span style="color:#D73A49;">.</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">substr</span><span style="color:#24292E;"> ( $sourcestr, $i, </span><span style="color:#005CC5;">1</span><span style="color:#24292E;"> );</span></span>
<span class="line"><span style="color:#24292E;">		  $i </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $i </span><span style="color:#D73A49;">+</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">1</span><span style="color:#24292E;">; </span><span style="color:#6A737D;">//实际的Byte数仍计1个</span></span>
<span class="line"><span style="color:#24292E;">		  $n </span><span style="color:#D73A49;">++</span><span style="color:#24292E;">; </span><span style="color:#6A737D;">//但考虑整体美观，大写字母计成一个高位字符</span></span>
<span class="line"><span style="color:#24292E;">		} </span><span style="color:#D73A49;">else</span><span style="color:#24292E;"> {</span><span style="color:#6A737D;">//其他情况下，半角标点符号，</span></span>
<span class="line"><span style="color:#24292E;">		 $returnstr </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $returnstr </span><span style="color:#D73A49;">.</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">substr</span><span style="color:#24292E;"> ( $sourcestr, $i, </span><span style="color:#005CC5;">1</span><span style="color:#24292E;"> );</span></span>
<span class="line"><span style="color:#24292E;">		 $i </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $i </span><span style="color:#D73A49;">+</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">1</span><span style="color:#24292E;">; </span></span>
<span class="line"><span style="color:#24292E;">		 $n </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $n </span><span style="color:#D73A49;">+</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">0.5</span><span style="color:#24292E;">; </span></span>
<span class="line"><span style="color:#24292E;">		}</span></span>
<span class="line"><span style="color:#24292E;">	   }</span></span>
<span class="line"><span style="color:#24292E;">	   </span><span style="color:#D73A49;">if</span><span style="color:#24292E;">($i</span><span style="color:#D73A49;">&lt;</span><span style="color:#24292E;">$str_length){</span></span>
<span class="line"><span style="color:#24292E;">		$returnstr</span><span style="color:#D73A49;">.=</span><span style="color:#032F62;">&#39;...&#39;</span><span style="color:#24292E;">;   </span></span>
<span class="line"><span style="color:#24292E;">	   }</span></span>
<span class="line"><span style="color:#24292E;">	   </span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> $returnstr;</span></span>
<span class="line"><span style="color:#24292E;">}</span></span>
<span class="line"><span style="color:#6A737D;">//过滤sql数值-公共方法</span></span>
<span class="line"><span style="color:#D73A49;">function</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">new_addslashes</span><span style="color:#24292E;">($string){</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">if</span><span style="color:#24292E;">(</span><span style="color:#D73A49;">!</span><span style="color:#005CC5;">is_array</span><span style="color:#24292E;">($string)) </span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">addslashes</span><span style="color:#24292E;">($string);</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">foreach</span><span style="color:#24292E;">($string </span><span style="color:#D73A49;">as</span><span style="color:#24292E;"> $key </span><span style="color:#D73A49;">=&gt;</span><span style="color:#24292E;"> $val){</span></span>
<span class="line"><span style="color:#24292E;">		$string[$key] </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">addslashes</span><span style="color:#24292E;">($val);</span></span>
<span class="line"><span style="color:#24292E;">	}</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> $string;</span></span>
<span class="line"><span style="color:#24292E;">}</span></span>
<span class="line"><span style="color:#6A737D;">//保留空格与回车</span></span>
<span class="line"><span style="color:#D73A49;">function</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">str2html</span><span style="color:#24292E;">($content,$re</span><span style="color:#D73A49;">=</span><span style="color:#005CC5;">false</span><span style="color:#24292E;">){</span></span>
<span class="line"></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">if</span><span style="color:#24292E;">($re){</span></span>
<span class="line"><span style="color:#24292E;">		$pattern </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">array</span><span style="color:#24292E;">(</span></span>
<span class="line"><span style="color:#24292E;">			</span><span style="color:#032F62;">&#39; &#39;</span><span style="color:#24292E;">,</span><span style="color:#6A737D;">//半角下空格</span></span>
<span class="line"><span style="color:#24292E;">			</span><span style="color:#032F62;">&#39;　&#39;</span><span style="color:#24292E;">,</span><span style="color:#6A737D;">//全角下空格</span></span>
<span class="line"><span style="color:#24292E;">			</span><span style="color:#032F62;">&#39;\r\n&#39;</span><span style="color:#24292E;">,</span><span style="color:#6A737D;">//window 下换行符</span></span>
<span class="line"><span style="color:#24292E;">			</span><span style="color:#032F62;">&#39;\n&#39;</span><span style="color:#6A737D;">//Linux &amp;&amp; Unix 下换行符</span></span>
<span class="line"><span style="color:#24292E;">		);</span></span>
<span class="line"><span style="color:#24292E;">		$replace </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">array</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;/&amp;nbsp;/&#39;</span><span style="color:#24292E;">,</span><span style="color:#032F62;">&#39;/&amp;nbsp;/&#39;</span><span style="color:#24292E;">,</span><span style="color:#032F62;">&#39;/&lt;br </span><span style="color:#22863A;font-weight:bold;">\/</span><span style="color:#032F62;">&gt;/&#39;</span><span style="color:#24292E;">,</span><span style="color:#032F62;">&#39;/&lt;br </span><span style="color:#22863A;font-weight:bold;">\/</span><span style="color:#032F62;">&gt;/&#39;</span><span style="color:#24292E;">); </span></span>
<span class="line"><span style="color:#24292E;">		</span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">preg_replace</span><span style="color:#24292E;">($replace,$pattern, $content);</span></span>
<span class="line"><span style="color:#24292E;">	}</span><span style="color:#D73A49;">else</span><span style="color:#24292E;">{</span></span>
<span class="line"><span style="color:#24292E;">		$pattern </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">array</span><span style="color:#24292E;">(</span></span>
<span class="line"><span style="color:#24292E;">			</span><span style="color:#032F62;">&#39;/ /&#39;</span><span style="color:#24292E;">,</span><span style="color:#6A737D;">//半角下空格</span></span>
<span class="line"><span style="color:#24292E;">			</span><span style="color:#032F62;">&#39;/　/&#39;</span><span style="color:#24292E;">,</span><span style="color:#6A737D;">//全角下空格</span></span>
<span class="line"><span style="color:#24292E;">			</span><span style="color:#032F62;">&#39;/</span><span style="color:#22863A;font-weight:bold;">\r\n</span><span style="color:#032F62;">/&#39;</span><span style="color:#24292E;">,</span><span style="color:#6A737D;">//window 下换行符</span></span>
<span class="line"><span style="color:#24292E;">			</span><span style="color:#032F62;">&#39;/</span><span style="color:#22863A;font-weight:bold;">\n</span><span style="color:#032F62;">/&#39;</span><span style="color:#6A737D;">//Linux &amp;&amp; Unix 下换行符</span></span>
<span class="line"><span style="color:#24292E;">		);</span></span>
<span class="line"><span style="color:#24292E;">		$replace </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">array</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;&amp;nbsp;&#39;</span><span style="color:#24292E;">,</span><span style="color:#032F62;">&#39;&amp;nbsp;&#39;</span><span style="color:#24292E;">,</span><span style="color:#032F62;">&#39;&lt;br /&gt;&#39;</span><span style="color:#24292E;">,</span><span style="color:#032F62;">&#39;&lt;br /&gt;&#39;</span><span style="color:#24292E;">); </span></span>
<span class="line"><span style="color:#24292E;">		</span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">preg_replace</span><span style="color:#24292E;">($pattern, $replace,$content);</span></span>
<span class="line"><span style="color:#24292E;">	}</span></span>
<span class="line"></span>
<span class="line"><span style="color:#24292E;">}</span></span>
<span class="line"><span style="color:#6A737D;">//数组取字段转化字符串</span></span>
<span class="line"><span style="color:#D73A49;">function</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">arr2str</span><span style="color:#24292E;">($arr,$word,$tag</span><span style="color:#D73A49;">=</span><span style="color:#032F62;">&#39;,&#39;</span><span style="color:#24292E;">){</span></span>
<span class="line"><span style="color:#24292E;">	$str </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&#39;&#39;</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">if</span><span style="color:#24292E;">(</span><span style="color:#D73A49;">!</span><span style="color:#005CC5;">is_array</span><span style="color:#24292E;">($arr)){</span></span>
<span class="line"><span style="color:#24292E;">		</span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">false</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">	}	</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">foreach</span><span style="color:#24292E;">($arr </span><span style="color:#D73A49;">as</span><span style="color:#24292E;"> $kk</span><span style="color:#D73A49;">=&gt;</span><span style="color:#24292E;">$vv){</span></span>
<span class="line"><span style="color:#24292E;">		</span><span style="color:#D73A49;">if</span><span style="color:#24292E;">(</span><span style="color:#D73A49;">!</span><span style="color:#24292E;">$vv[$word]){</span></span>
<span class="line"><span style="color:#24292E;">			</span><span style="color:#D73A49;">continue</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">		}</span></span>
<span class="line"><span style="color:#24292E;">		$str</span><span style="color:#D73A49;">.=</span><span style="color:#032F62;">&#39;,&#39;</span><span style="color:#D73A49;">.</span><span style="color:#24292E;">$vv[$word];</span></span>
<span class="line"><span style="color:#24292E;">	}</span></span>
<span class="line"><span style="color:#24292E;">	$str </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">trim</span><span style="color:#24292E;">($str,</span><span style="color:#032F62;">&#39;,&#39;</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">if</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">empty</span><span style="color:#24292E;">($str)){</span></span>
<span class="line"><span style="color:#24292E;">       </span><span style="color:#D73A49;">return</span><span style="color:#24292E;">  </span><span style="color:#D73A49;">-</span><span style="color:#005CC5;">1</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">    }</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">str_replace</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;,&#39;</span><span style="color:#24292E;">,$tag,$str);</span></span>
<span class="line"><span style="color:#24292E;">}</span></span>
<span class="line"><span style="color:#6A737D;">/**</span></span>
<span class="line"><span style="color:#6A737D;">*获取ip地址</span></span>
<span class="line"><span style="color:#6A737D;">*/</span></span>
<span class="line"><span style="color:#D73A49;">function</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">get_real_ip</span><span style="color:#24292E;">()  {  </span></span>
<span class="line"><span style="color:#24292E;">    $ip</span><span style="color:#D73A49;">=</span><span style="color:#005CC5;">false</span><span style="color:#24292E;">;  </span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">if</span><span style="color:#24292E;">(</span><span style="color:#D73A49;">!</span><span style="color:#005CC5;">empty</span><span style="color:#24292E;">($_SERVER[</span><span style="color:#032F62;">&quot;HTTP_CLIENT_IP&quot;</span><span style="color:#24292E;">])){  </span></span>
<span class="line"><span style="color:#24292E;">      $ip </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $_SERVER[</span><span style="color:#032F62;">&quot;HTTP_CLIENT_IP&quot;</span><span style="color:#24292E;">];  </span></span>
<span class="line"><span style="color:#24292E;">    }  </span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">if</span><span style="color:#24292E;"> (</span><span style="color:#D73A49;">!</span><span style="color:#005CC5;">empty</span><span style="color:#24292E;">($_SERVER[</span><span style="color:#032F62;">&#39;HTTP_X_FORWARDED_FOR&#39;</span><span style="color:#24292E;">])){  </span></span>
<span class="line"><span style="color:#24292E;">          $ips </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">explode</span><span style="color:#24292E;"> (</span><span style="color:#032F62;">&quot;, &quot;</span><span style="color:#24292E;">, $_SERVER[</span><span style="color:#032F62;">&#39;HTTP_X_FORWARDED_FOR&#39;</span><span style="color:#24292E;">]);  </span></span>
<span class="line"><span style="color:#24292E;">          </span><span style="color:#D73A49;">if</span><span style="color:#24292E;">($ip){  </span></span>
<span class="line"><span style="color:#24292E;">           </span><span style="color:#005CC5;">array_unshift</span><span style="color:#24292E;">($ips, $ip); $ip </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">FALSE</span><span style="color:#24292E;">;  </span></span>
<span class="line"><span style="color:#24292E;">          }  </span></span>
<span class="line"><span style="color:#24292E;">          </span><span style="color:#D73A49;">for</span><span style="color:#24292E;">($i </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">0</span><span style="color:#24292E;">; $i </span><span style="color:#D73A49;">&lt;</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">count</span><span style="color:#24292E;">($ips); $i</span><span style="color:#D73A49;">++</span><span style="color:#24292E;">){  </span></span>
<span class="line"><span style="color:#24292E;">               </span><span style="color:#D73A49;">if</span><span style="color:#24292E;"> (</span><span style="color:#D73A49;">!</span><span style="color:#005CC5;">eregi</span><span style="color:#24292E;"> (</span><span style="color:#032F62;">&quot;^(10|172.16|192.168).&quot;</span><span style="color:#24292E;">, $ips[$i])){  </span></span>
<span class="line"><span style="color:#24292E;">                    $ip </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $ips[$i];  </span></span>
<span class="line"><span style="color:#24292E;">                    </span><span style="color:#D73A49;">break</span><span style="color:#24292E;">;  </span></span>
<span class="line"><span style="color:#24292E;">               }  </span></span>
<span class="line"><span style="color:#24292E;">          }  </span></span>
<span class="line"><span style="color:#24292E;">    }  </span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">return</span><span style="color:#24292E;">($ip</span><span style="color:#D73A49;">?</span><span style="color:#24292E;">$ip</span><span style="color:#D73A49;">:</span><span style="color:#24292E;">$_SERVER[</span><span style="color:#032F62;">&#39;REMOTE_ADDR&#39;</span><span style="color:#24292E;">]);  </span></span>
<span class="line"><span style="color:#24292E;">}</span></span>
<span class="line"><span style="color:#6A737D;">/*</span></span>
<span class="line"><span style="color:#6A737D;"> 查询联表信息 取关联数据</span></span>
<span class="line"><span style="color:#6A737D;">@parm $table 查询的数据表</span></span>
<span class="line"><span style="color:#6A737D;">@parm $ids_arr 查询条件数组</span></span>
<span class="line"><span style="color:#6A737D;">@parm $field_arr  获取字段数组</span></span>
<span class="line"><span style="color:#6A737D;">@parm $table_join  外键对应字段</span></span>
<span class="line"><span style="color:#6A737D;">*/</span></span>
<span class="line"><span style="color:#D73A49;">function</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">getInfoByIds</span><span style="color:#24292E;">($table,$ids_arr,$field_arr,$table_join){</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">if</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">empty</span><span style="color:#24292E;">($ids_arr) </span><span style="color:#D73A49;">||</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">empty</span><span style="color:#24292E;">($field_arr) </span><span style="color:#D73A49;">||</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">!</span><span style="color:#005CC5;">is_array</span><span style="color:#24292E;">($ids_arr) </span><span style="color:#D73A49;">||</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">!</span><span style="color:#005CC5;">is_array</span><span style="color:#24292E;">($field_arr)){</span></span>
<span class="line"><span style="color:#24292E;">		</span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">array</span><span style="color:#24292E;">();</span></span>
<span class="line"><span style="color:#24292E;">	}</span></span>
<span class="line"><span style="color:#24292E;">	$user_ids </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">implode</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;,&#39;</span><span style="color:#24292E;">,$ids_arr);</span></span>
<span class="line"><span style="color:#24292E;">	$fields </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">implode</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;,&#39;</span><span style="color:#24292E;">,$field_arr);  </span></span>
<span class="line"><span style="color:#24292E;">	$sql </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&quot;select &quot;</span><span style="color:#D73A49;">.</span><span style="color:#24292E;">$table_join</span><span style="color:#D73A49;">.</span><span style="color:#032F62;">&quot;,&quot;</span><span style="color:#D73A49;">.</span><span style="color:#24292E;">$fields</span><span style="color:#D73A49;">.</span><span style="color:#032F62;">&quot; from &quot;</span><span style="color:#D73A49;">.</span><span style="color:#24292E;">$table</span><span style="color:#D73A49;">.</span><span style="color:#032F62;">&quot; where &quot;</span><span style="color:#D73A49;">.</span><span style="color:#24292E;">$table_join</span><span style="color:#D73A49;">.</span><span style="color:#032F62;">&quot; in(&quot;</span><span style="color:#D73A49;">.</span><span style="color:#24292E;">$user_ids</span><span style="color:#D73A49;">.</span><span style="color:#032F62;">&quot;)&quot;</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">	$member_info </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">$this</span><span style="color:#D73A49;">-&gt;</span><span style="color:#6F42C1;">db</span><span style="color:#24292E;">()</span><span style="color:#D73A49;">-&gt;</span><span style="color:#6F42C1;">getAll</span><span style="color:#24292E;">($sql);</span></span>
<span class="line"><span style="color:#24292E;">	$return_arr </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">array</span><span style="color:#24292E;">();</span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">foreach</span><span style="color:#24292E;">($member_info </span><span style="color:#D73A49;">as</span><span style="color:#24292E;"> $kk</span><span style="color:#D73A49;">=&gt;</span><span style="color:#24292E;">$vv){</span></span>
<span class="line"><span style="color:#24292E;">		$return_arr[$vv[$table_join]]</span><span style="color:#D73A49;">=</span><span style="color:#24292E;">$vv;</span></span>
<span class="line"><span style="color:#24292E;">	}  </span></span>
<span class="line"><span style="color:#24292E;">	</span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> $return_arr;</span></span>
<span class="line"><span style="color:#24292E;">}</span></span>
<span class="line"><span style="color:#6A737D;">/*</span></span>
<span class="line"><span style="color:#6A737D;">* 加密解密字符</span></span>
<span class="line"><span style="color:#6A737D;">* parm $operation  DECODE解密 ENCODE加密</span></span>
<span class="line"><span style="color:#6A737D;">*  parm $string 要加密解密的字符</span></span>
<span class="line"><span style="color:#6A737D;">* parm $key 验证关键字</span></span>
<span class="line"><span style="color:#6A737D;">*/</span></span>
<span class="line"></span>
<span class="line"><span style="color:#D73A49;">function</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">encryptDecrypt</span><span style="color:#24292E;">($string, $operation </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&#39;DECODE&#39;</span><span style="color:#24292E;">, $key </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&#39;&#39;</span><span style="color:#24292E;">, $expiry </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">0</span><span style="color:#24292E;">) {</span></span>
<span class="line"><span style="color:#24292E;">		</span></span>
<span class="line"><span style="color:#24292E;">	  $auth_key </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&#39;%&amp;black_technology_YYYY!Q@W#$6y8i*&amp;%&#39;</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">      $ckey_length </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">4</span><span style="color:#24292E;">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#24292E;">      $key </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">md5</span><span style="color:#24292E;">($key </span><span style="color:#D73A49;">?</span><span style="color:#24292E;"> $key </span><span style="color:#D73A49;">:</span><span style="color:#24292E;"> $auth_key);</span></span>
<span class="line"><span style="color:#24292E;">      $keya </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">md5</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">substr</span><span style="color:#24292E;">($key, </span><span style="color:#005CC5;">0</span><span style="color:#24292E;">, </span><span style="color:#005CC5;">16</span><span style="color:#24292E;">));</span></span>
<span class="line"><span style="color:#24292E;">      $keyb </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">md5</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">substr</span><span style="color:#24292E;">($key, </span><span style="color:#005CC5;">16</span><span style="color:#24292E;">, </span><span style="color:#005CC5;">16</span><span style="color:#24292E;">));</span></span>
<span class="line"><span style="color:#24292E;">      $keyc </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $ckey_length </span><span style="color:#D73A49;">?</span><span style="color:#24292E;"> ($operation </span><span style="color:#D73A49;">==</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&#39;DECODE&#39;</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">?</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">substr</span><span style="color:#24292E;">($string, </span><span style="color:#005CC5;">0</span><span style="color:#24292E;">, $ckey_length) </span><span style="color:#D73A49;">:</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">substr</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">md5</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">microtime</span><span style="color:#24292E;">()), </span><span style="color:#D73A49;">-</span><span style="color:#24292E;">$ckey_length)) </span><span style="color:#D73A49;">:</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&#39;&#39;</span><span style="color:#24292E;">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#24292E;">      $cryptkey </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $keya </span><span style="color:#D73A49;">.</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">md5</span><span style="color:#24292E;">($keya </span><span style="color:#D73A49;">.</span><span style="color:#24292E;"> $keyc);</span></span>
<span class="line"><span style="color:#24292E;">      $key_length </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">strlen</span><span style="color:#24292E;">($cryptkey);</span></span>
<span class="line"></span>
<span class="line"><span style="color:#24292E;">      $string </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $operation </span><span style="color:#D73A49;">==</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&#39;DECODE&#39;</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">?</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">base64_decode</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">strtr</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">substr</span><span style="color:#24292E;">($string, $ckey_length), </span><span style="color:#032F62;">&#39;-_&#39;</span><span style="color:#24292E;">, </span><span style="color:#032F62;">&#39;+/&#39;</span><span style="color:#24292E;">))</span><span style="color:#D73A49;">:</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">sprintf</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;%010d&#39;</span><span style="color:#24292E;">, $expiry </span><span style="color:#D73A49;">?</span><span style="color:#24292E;"> $expiry </span><span style="color:#D73A49;">+</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">time</span><span style="color:#24292E;">() </span><span style="color:#D73A49;">:</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">0</span><span style="color:#24292E;">) </span><span style="color:#D73A49;">.</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">substr</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">md5</span><span style="color:#24292E;">($string </span><span style="color:#D73A49;">.</span><span style="color:#24292E;"> $keyb), </span><span style="color:#005CC5;">0</span><span style="color:#24292E;">, </span><span style="color:#005CC5;">16</span><span style="color:#24292E;">) </span><span style="color:#D73A49;">.</span><span style="color:#24292E;"> $string;</span></span>
<span class="line"><span style="color:#24292E;">      $string_length </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">strlen</span><span style="color:#24292E;">($string);</span></span>
<span class="line"></span>
<span class="line"><span style="color:#24292E;">      $result </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&#39;&#39;</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">      $box </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">range</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">0</span><span style="color:#24292E;">, </span><span style="color:#005CC5;">255</span><span style="color:#24292E;">);</span></span>
<span class="line"></span>
<span class="line"><span style="color:#24292E;">      $rndkey </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">array</span><span style="color:#24292E;">();</span></span>
<span class="line"><span style="color:#24292E;">      </span><span style="color:#D73A49;">for</span><span style="color:#24292E;"> ($i </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">0</span><span style="color:#24292E;">; $i </span><span style="color:#D73A49;">&lt;=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">255</span><span style="color:#24292E;">; $i</span><span style="color:#D73A49;">++</span><span style="color:#24292E;">) {</span></span>
<span class="line"><span style="color:#24292E;">          $rndkey[$i] </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">ord</span><span style="color:#24292E;">($cryptkey[$i </span><span style="color:#D73A49;">%</span><span style="color:#24292E;"> $key_length]);</span></span>
<span class="line"><span style="color:#24292E;">      }</span></span>
<span class="line"></span>
<span class="line"><span style="color:#24292E;">      </span><span style="color:#D73A49;">for</span><span style="color:#24292E;"> ($j </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $i </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">0</span><span style="color:#24292E;">; $i </span><span style="color:#D73A49;">&lt;</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">256</span><span style="color:#24292E;">; $i</span><span style="color:#D73A49;">++</span><span style="color:#24292E;">) {</span></span>
<span class="line"><span style="color:#24292E;">          $j </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> ($j </span><span style="color:#D73A49;">+</span><span style="color:#24292E;"> $box[$i] </span><span style="color:#D73A49;">+</span><span style="color:#24292E;"> $rndkey[$i]) </span><span style="color:#D73A49;">%</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">256</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">          $tmp </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $box[$i];</span></span>
<span class="line"><span style="color:#24292E;">          $box[$i] </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $box[$j];</span></span>
<span class="line"><span style="color:#24292E;">          $box[$j] </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $tmp;</span></span>
<span class="line"><span style="color:#24292E;">      }</span></span>
<span class="line"></span>
<span class="line"><span style="color:#24292E;">      </span><span style="color:#D73A49;">for</span><span style="color:#24292E;"> ($a </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $j </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $i </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">0</span><span style="color:#24292E;">; $i </span><span style="color:#D73A49;">&lt;</span><span style="color:#24292E;"> $string_length; $i</span><span style="color:#D73A49;">++</span><span style="color:#24292E;">) {</span></span>
<span class="line"><span style="color:#24292E;">          $a </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> ($a </span><span style="color:#D73A49;">+</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">1</span><span style="color:#24292E;">) </span><span style="color:#D73A49;">%</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">256</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">          $j </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> ($j </span><span style="color:#D73A49;">+</span><span style="color:#24292E;"> $box[$a]) </span><span style="color:#D73A49;">%</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">256</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">          $tmp </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $box[$a];</span></span>
<span class="line"><span style="color:#24292E;">          $box[$a] </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $box[$j];</span></span>
<span class="line"><span style="color:#24292E;">          $box[$j] </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> $tmp;</span></span>
<span class="line"><span style="color:#24292E;">          $result </span><span style="color:#D73A49;">.=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">chr</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">ord</span><span style="color:#24292E;">($string[$i]) </span><span style="color:#D73A49;">^</span><span style="color:#24292E;"> ($box[($box[$a] </span><span style="color:#D73A49;">+</span><span style="color:#24292E;"> $box[$j]) </span><span style="color:#D73A49;">%</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">256</span><span style="color:#24292E;">]));</span></span>
<span class="line"><span style="color:#24292E;">      }</span></span>
<span class="line"></span>
<span class="line"><span style="color:#24292E;">      </span><span style="color:#D73A49;">if</span><span style="color:#24292E;"> ($operation </span><span style="color:#D73A49;">==</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&#39;DECODE&#39;</span><span style="color:#24292E;">) {</span></span>
<span class="line"><span style="color:#24292E;">          </span><span style="color:#D73A49;">if</span><span style="color:#24292E;"> ((</span><span style="color:#005CC5;">substr</span><span style="color:#24292E;">($result, </span><span style="color:#005CC5;">0</span><span style="color:#24292E;">, </span><span style="color:#005CC5;">10</span><span style="color:#24292E;">) </span><span style="color:#D73A49;">==</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">0</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">||</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">substr</span><span style="color:#24292E;">($result, </span><span style="color:#005CC5;">0</span><span style="color:#24292E;">, </span><span style="color:#005CC5;">10</span><span style="color:#24292E;">) </span><span style="color:#D73A49;">-</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">time</span><span style="color:#24292E;">() </span><span style="color:#D73A49;">&gt;</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">0</span><span style="color:#24292E;">) </span><span style="color:#D73A49;">&amp;&amp;</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">substr</span><span style="color:#24292E;">($result, </span><span style="color:#005CC5;">10</span><span style="color:#24292E;">, </span><span style="color:#005CC5;">16</span><span style="color:#24292E;">) </span><span style="color:#D73A49;">==</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">substr</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">md5</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">substr</span><span style="color:#24292E;">($result, </span><span style="color:#005CC5;">26</span><span style="color:#24292E;">) </span><span style="color:#D73A49;">.</span><span style="color:#24292E;"> $keyb), </span><span style="color:#005CC5;">0</span><span style="color:#24292E;">, </span><span style="color:#005CC5;">16</span><span style="color:#24292E;">)) {</span></span>
<span class="line"><span style="color:#24292E;">              </span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">substr</span><span style="color:#24292E;">($result, </span><span style="color:#005CC5;">26</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">          } </span><span style="color:#D73A49;">else</span><span style="color:#24292E;"> {</span></span>
<span class="line"><span style="color:#24292E;">              </span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&#39;&#39;</span><span style="color:#24292E;">;</span></span>
<span class="line"><span style="color:#24292E;">          }</span></span>
<span class="line"><span style="color:#24292E;">      } </span><span style="color:#D73A49;">else</span><span style="color:#24292E;"> {</span></span>
<span class="line"><span style="color:#24292E;">          </span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> $keyc </span><span style="color:#D73A49;">.</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">str_replace</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;=&#39;</span><span style="color:#24292E;">, </span><span style="color:#032F62;">&#39;&#39;</span><span style="color:#24292E;">, </span><span style="color:#005CC5;">rtrim</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">strtr</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">base64_encode</span><span style="color:#24292E;">($result), </span><span style="color:#032F62;">&#39;+/&#39;</span><span style="color:#24292E;">, </span><span style="color:#032F62;">&#39;-_&#39;</span><span style="color:#24292E;">), </span><span style="color:#032F62;">&#39;=&#39;</span><span style="color:#24292E;">));</span></span>
<span class="line"><span style="color:#24292E;">      }</span></span>
<span class="line"><span style="color:#24292E;">    }</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br><span class="line-number">33</span><br><span class="line-number">34</span><br><span class="line-number">35</span><br><span class="line-number">36</span><br><span class="line-number">37</span><br><span class="line-number">38</span><br><span class="line-number">39</span><br><span class="line-number">40</span><br><span class="line-number">41</span><br><span class="line-number">42</span><br><span class="line-number">43</span><br><span class="line-number">44</span><br><span class="line-number">45</span><br><span class="line-number">46</span><br><span class="line-number">47</span><br><span class="line-number">48</span><br><span class="line-number">49</span><br><span class="line-number">50</span><br><span class="line-number">51</span><br><span class="line-number">52</span><br><span class="line-number">53</span><br><span class="line-number">54</span><br><span class="line-number">55</span><br><span class="line-number">56</span><br><span class="line-number">57</span><br><span class="line-number">58</span><br><span class="line-number">59</span><br><span class="line-number">60</span><br><span class="line-number">61</span><br><span class="line-number">62</span><br><span class="line-number">63</span><br><span class="line-number">64</span><br><span class="line-number">65</span><br><span class="line-number">66</span><br><span class="line-number">67</span><br><span class="line-number">68</span><br><span class="line-number">69</span><br><span class="line-number">70</span><br><span class="line-number">71</span><br><span class="line-number">72</span><br><span class="line-number">73</span><br><span class="line-number">74</span><br><span class="line-number">75</span><br><span class="line-number">76</span><br><span class="line-number">77</span><br><span class="line-number">78</span><br><span class="line-number">79</span><br><span class="line-number">80</span><br><span class="line-number">81</span><br><span class="line-number">82</span><br><span class="line-number">83</span><br><span class="line-number">84</span><br><span class="line-number">85</span><br><span class="line-number">86</span><br><span class="line-number">87</span><br><span class="line-number">88</span><br><span class="line-number">89</span><br><span class="line-number">90</span><br><span class="line-number">91</span><br><span class="line-number">92</span><br><span class="line-number">93</span><br><span class="line-number">94</span><br><span class="line-number">95</span><br><span class="line-number">96</span><br><span class="line-number">97</span><br><span class="line-number">98</span><br><span class="line-number">99</span><br><span class="line-number">100</span><br><span class="line-number">101</span><br><span class="line-number">102</span><br><span class="line-number">103</span><br><span class="line-number">104</span><br><span class="line-number">105</span><br><span class="line-number">106</span><br><span class="line-number">107</span><br><span class="line-number">108</span><br><span class="line-number">109</span><br><span class="line-number">110</span><br><span class="line-number">111</span><br><span class="line-number">112</span><br><span class="line-number">113</span><br><span class="line-number">114</span><br><span class="line-number">115</span><br><span class="line-number">116</span><br><span class="line-number">117</span><br><span class="line-number">118</span><br><span class="line-number">119</span><br><span class="line-number">120</span><br><span class="line-number">121</span><br><span class="line-number">122</span><br><span class="line-number">123</span><br><span class="line-number">124</span><br><span class="line-number">125</span><br><span class="line-number">126</span><br><span class="line-number">127</span><br><span class="line-number">128</span><br><span class="line-number">129</span><br><span class="line-number">130</span><br><span class="line-number">131</span><br><span class="line-number">132</span><br><span class="line-number">133</span><br><span class="line-number">134</span><br><span class="line-number">135</span><br><span class="line-number">136</span><br><span class="line-number">137</span><br><span class="line-number">138</span><br><span class="line-number">139</span><br><span class="line-number">140</span><br><span class="line-number">141</span><br><span class="line-number">142</span><br><span class="line-number">143</span><br><span class="line-number">144</span><br><span class="line-number">145</span><br><span class="line-number">146</span><br><span class="line-number">147</span><br><span class="line-number">148</span><br><span class="line-number">149</span><br><span class="line-number">150</span><br><span class="line-number">151</span><br><span class="line-number">152</span><br><span class="line-number">153</span><br><span class="line-number">154</span><br><span class="line-number">155</span><br><span class="line-number">156</span><br><span class="line-number">157</span><br><span class="line-number">158</span><br><span class="line-number">159</span><br><span class="line-number">160</span><br><span class="line-number">161</span><br><span class="line-number">162</span><br><span class="line-number">163</span><br><span class="line-number">164</span><br><span class="line-number">165</span><br><span class="line-number">166</span><br><span class="line-number">167</span><br><span class="line-number">168</span><br><span class="line-number">169</span><br><span class="line-number">170</span><br><span class="line-number">171</span><br><span class="line-number">172</span><br><span class="line-number">173</span><br><span class="line-number">174</span><br><span class="line-number">175</span><br><span class="line-number">176</span><br><span class="line-number">177</span><br><span class="line-number">178</span><br><span class="line-number">179</span><br><span class="line-number">180</span><br><span class="line-number">181</span><br><span class="line-number">182</span><br><span class="line-number">183</span><br><span class="line-number">184</span><br><span class="line-number">185</span><br><span class="line-number">186</span><br><span class="line-number">187</span><br><span class="line-number">188</span><br><span class="line-number">189</span><br><span class="line-number">190</span><br><span class="line-number">191</span><br><span class="line-number">192</span><br><span class="line-number">193</span><br><span class="line-number">194</span><br><span class="line-number">195</span><br><span class="line-number">196</span><br><span class="line-number">197</span><br><span class="line-number">198</span><br><span class="line-number">199</span><br><span class="line-number">200</span><br><span class="line-number">201</span><br><span class="line-number">202</span><br><span class="line-number">203</span><br><span class="line-number">204</span><br><span class="line-number">205</span><br><span class="line-number">206</span><br><span class="line-number">207</span><br><span class="line-number">208</span><br><span class="line-number">209</span><br><span class="line-number">210</span><br><span class="line-number">211</span><br><span class="line-number">212</span><br><span class="line-number">213</span><br><span class="line-number">214</span><br><span class="line-number">215</span><br><span class="line-number">216</span><br><span class="line-number">217</span><br><span class="line-number">218</span><br><span class="line-number">219</span><br><span class="line-number">220</span><br><span class="line-number">221</span><br><span class="line-number">222</span><br><span class="line-number">223</span><br><span class="line-number">224</span><br><span class="line-number">225</span><br><span class="line-number">226</span><br><span class="line-number">227</span><br><span class="line-number">228</span><br><span class="line-number">229</span><br><span class="line-number">230</span><br><span class="line-number">231</span><br><span class="line-number">232</span><br><span class="line-number">233</span><br><span class="line-number">234</span><br><span class="line-number">235</span><br><span class="line-number">236</span><br><span class="line-number">237</span><br><span class="line-number">238</span><br><span class="line-number">239</span><br><span class="line-number">240</span><br><span class="line-number">241</span><br><span class="line-number">242</span><br><span class="line-number">243</span><br><span class="line-number">244</span><br><span class="line-number">245</span><br><span class="line-number">246</span><br><span class="line-number">247</span><br><span class="line-number">248</span><br><span class="line-number">249</span><br><span class="line-number">250</span><br><span class="line-number">251</span><br><span class="line-number">252</span><br><span class="line-number">253</span><br><span class="line-number">254</span><br><span class="line-number">255</span><br><span class="line-number">256</span><br><span class="line-number">257</span><br><span class="line-number">258</span><br><span class="line-number">259</span><br><span class="line-number">260</span><br><span class="line-number">261</span><br><span class="line-number">262</span><br><span class="line-number">263</span><br><span class="line-number">264</span><br><span class="line-number">265</span><br><span class="line-number">266</span><br><span class="line-number">267</span><br><span class="line-number">268</span><br><span class="line-number">269</span><br><span class="line-number">270</span><br><span class="line-number">271</span><br><span class="line-number">272</span><br><span class="line-number">273</span><br><span class="line-number">274</span><br><span class="line-number">275</span><br><span class="line-number">276</span><br><span class="line-number">277</span><br><span class="line-number">278</span><br><span class="line-number">279</span><br><span class="line-number">280</span><br></div></div></div></div></main><footer class="VPDocFooter" data-v-6b87e69f data-v-ef5dee53><!--[--><!--]--><!----><nav class="prev-next" data-v-ef5dee53><div class="pager" data-v-ef5dee53><a class="pager-link prev" href="/tools/mysql%E5%91%BD%E4%BB%A4.html" data-v-ef5dee53><span class="desc" data-v-ef5dee53>Previous page</span><span class="title" data-v-ef5dee53>mysql命令</span></a></div><div class="pager" data-v-ef5dee53><a class="pager-link next" href="/tools/react.html" data-v-ef5dee53><span class="desc" data-v-ef5dee53>Next page</span><span class="title" data-v-ef5dee53>react</span></a></div></nav></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><!----><!--[--><!--]--></div></div>
    <script>window.__VP_HASH_MAP__=JSON.parse("{\"case_getaccesstoken.md\":\"67a16083\",\"case_前端日志.md\":\"270996e6\",\"case_前端防切屏.md\":\"6d67367b\",\"ai学习笔记_个人理解.md\":\"62e8b40f\",\"case_vue实例技巧.md\":\"75787181\",\"日志_关于企业站的seo.md\":\"496419f4\",\"case_插件使用配置.md\":\"fe83b1c1\",\"办公_版本处理方案.md\":\"e749eb0e\",\"办公_开发记录.md\":\"437c4662\",\"case_mac使用.md\":\"48c33f34\",\"办公_app开通微信支付.md\":\"95c825d6\",\"tools_arduino基础操作.md\":\"f997fb69\",\"日志_uniapp内存泄漏事件.md\":\"25a76630\",\"case_ios上架笔记.md\":\"84d52929\",\"case_开发富文本本编辑器.md\":\"d7842807\",\"办公_ebm后端及数据库笔记.md\":\"0c19b5f3\",\"case_uniapp踩坑记录.md\":\"4e47ad2a\",\"tools_conda命令  pip命令.md\":\"23ac8380\",\"办公_待解决问题.md\":\"dcc132f1\",\"case_优秀的开源vue组件.md\":\"6020f82e\",\"case_样式布局.md\":\"670153be\",\"tools_emmet web快速构建命令.md\":\"02ded381\",\"ai学习笔记_二、应用场景.md\":\"3985787b\",\"java笔记_程序基础.md\":\"750d7bf5\",\"日志_合格的文档.md\":\"e2dd10c4\",\"tools_index.md\":\"8efae136\",\"tools_设计规范.md\":\"c1e5222d\",\"case_转pdf相关.md\":\"9b047234\",\"case_vuex使用示例.md\":\"042f3339\",\"tools_elementui笔记.md\":\"d727814f\",\"办公_应用中心框架更新.md\":\"9124a7e9\",\"ai学习笔记_一、概念.md\":\"960b8e6d\",\"case_markdown文件转换目录列表.md\":\"f04a5805\",\"tools_cmd npm yarn pnpm命令.md\":\"deebc540\",\"case_css技巧.md\":\"cedd6cee\",\"ai学习笔记_四、模型.md\":\"f9d2ec81\",\"办公_代码示例_l律所起诉状.md\":\"f875bace\",\"tools_adb命令.md\":\"9831c553\",\"tools_命名汇总推荐.md\":\"3bf819e1\",\"办公_seo方案.md\":\"22a7e45f\",\"java笔记_面向对象编程.md\":\"486db2ad\",\"日志_测试笔记.md\":\"00dcc692\",\"case_python自动测试脚本.md\":\"bec8212a\",\"index.md\":\"25642d62\",\"tools_mac使用笔记.md\":\"9ee5b2a6\",\"办公_实施笔记.md\":\"10ecc800\",\"tools_vue笔记.md\":\"be570cd4\",\"ai学习笔记_五、模型发展.md\":\"a9feb551\",\"case_vue六种l传输方式.md\":\"cadce3ad\",\"case_index.md\":\"4370ee15\",\"ai学习笔记_六、开发.md\":\"0b1a367a\",\"tools_前端基础知识.md\":\"864e9786\",\"ai学习笔记_三、promt工程.md\":\"1b5a7f7c\",\"办公_todo.md\":\"2ccf3c97\",\"日志_前端自检项.md\":\"0544de55\",\"case_基础csss样式.md\":\"d368d629\",\"tools_react.md\":\"d032d22f\",\"case_数字化大屏问题点.md\":\"e37019d4\",\"tools_php基础及常用函数.md\":\"b2afeccf\",\"case_flutter安装配置.md\":\"ccbc694e\",\"tools_js知识点.md\":\"51436346\",\"case_富文本编辑器原理.md\":\"f3b0b2ee\",\"tools_mysql命令.md\":\"373a1b6c\",\"tools_linux命令.md\":\"82c20701\",\"办公_前端常用代码.md\":\"8923abd6\",\"tools_jquery的使用.md\":\"e9d67fbd\",\"tools_docker使用.md\":\"1ea0c513\",\"tools_uniapp笔记.md\":\"c0a178f5\",\"tools_git笔记.md\":\"9870fad6\",\"日志_自媒体笔记.md\":\"0d283ba7\",\"tools_linux域名配置及反向代理.md\":\"25492670\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"en-US\",\"dir\":\"ltr\",\"title\":\"阿泽的笔记\",\"description\":\"做一个努力的码农\",\"base\":\"/\",\"head\":[],\"appearance\":true,\"themeConfig\":{\"displayAllHeaders\":true,\"nav\":[{\"text\":\"首页\",\"link\":\"/\"},{\"text\":\"案例\",\"link\":\"/case/\"},{\"text\":\"工具\",\"link\":\"/tools/\"}],\"sidebar\":[{\"text\":\"工具\",\"collapsible\":true,\"collapsed\":true,\"items\":[{\"text\":\"adb命令\",\"link\":\"/tools/adb命令\"},{\"text\":\"arduino基础操作\",\"link\":\"/tools/arduino基础操作\"},{\"text\":\"cmd npm yarn pnpm命令\",\"link\":\"/tools/cmd npm yarn pnpm命令\"},{\"text\":\"elementUi笔记\",\"link\":\"/tools/elementUi笔记\"},{\"text\":\"Emmet Web快速构建命令\",\"link\":\"/tools/Emmet%20Web快速构建命令\"},{\"text\":\"git笔记\",\"link\":\"/tools/git笔记\"},{\"text\":\"js知识点\",\"link\":\"/tools/js知识点\"},{\"text\":\"linux命令\",\"link\":\"/tools/linux命令\"},{\"text\":\"linux域名配置及反向代理\",\"link\":\"/tools/linux域名配置及反向代理\"},{\"text\":\"mac使用笔记\",\"link\":\"/tools/mac使用笔记\"},{\"text\":\"mysql命令\",\"link\":\"/tools/mysql命令\"},{\"text\":\"php基础及常用函数\",\"link\":\"/tools/php基础及常用函数\"},{\"text\":\"react\",\"link\":\"/tools/react\"},{\"text\":\"uniapp笔记\",\"link\":\"/tools/uniapp笔记\"},{\"text\":\"vue笔记\",\"link\":\"/tools/vue笔记\"},{\"text\":\"前端基础知识\",\"link\":\"/tools/前端基础知识\"}]},{\"text\":\"案例\",\"collapsible\":true,\"collapsed\":true,\"items\":[{\"text\":\"css技巧\",\"link\":\"/case/css技巧\"},{\"text\":\"python自动测试脚本\",\"link\":\"/case/python自动测试脚本\"},{\"text\":\"uniapp踩坑记录\",\"link\":\"/case/uniapp踩坑记录\"},{\"text\":\"vuex使用示例\",\"link\":\"/case/vuex使用示例\"},{\"text\":\"vue六种l传输方式\",\"link\":\"/case/vue六种l传输方式\"},{\"text\":\"vue实例技巧\",\"link\":\"/case/vue实例技巧\"},{\"text\":\"优秀的开源vue组件\",\"link\":\"/case/优秀的开源vue组件\"},{\"text\":\"前端日志\",\"link\":\"/case/前端日志\"},{\"text\":\"开发富文本本编辑器\",\"link\":\"/case/开发富文本本编辑器\"},{\"text\":\"插件使用配置\",\"link\":\"/case/插件使用配置\"},{\"text\":\"样式布局\",\"link\":\"/case/样式布局\"},{\"text\":\"转pdf相关\",\"link\":\"/case/转pdf相关\"}]}]},\"locales\":{},\"scrollOffset\":90,\"cleanUrls\":false}");</script>
    
  </body>
</html>